Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for count(uid) with alias #4122

Merged
merged 1 commit into from
Oct 10, 2019
Merged

Support for count(uid) with alias #4122

merged 1 commit into from
Oct 10, 2019

Conversation

mangalaman93
Copy link
Contributor

@mangalaman93 mangalaman93 commented Oct 3, 2019

This change is Reviewable

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ A review job has been created and sent to the PullRequest network.


@mangalaman93 you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 Message
It looks like the description for this pull request is either blank or very short. Adding a high-level summary will help our reviewers provide better feedback. Feel free to include questions for PullRequest reviewers and make specific feedback requests.

query/query.go Outdated Show resolved Hide resolved
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning

PullRequest detected a force-push on this branch. This may have caused some information to be lost, and additional time may be required to complete review of the code. Read More

@mangalaman93 mangalaman93 changed the title temp Support for count(uid) with alias Oct 3, 2019
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less is more. Good job reducing the amount of fields/bloat and maintaining the inherent functionality.


Reviewed with ❤️ by PullRequest

gql/parser.go Show resolved Hide resolved
query/outputnode.go Outdated Show resolved Hide resolved
query/query0_test.go Outdated Show resolved Hide resolved
query/outputnode.go Outdated Show resolved Hide resolved
@mangalaman93 mangalaman93 force-pushed the aman/issue_4038 branch 2 times, most recently from 6cb796c to 41b9684 Compare October 8, 2019 21:04
@mangalaman93 mangalaman93 marked this pull request as ready for review October 8, 2019 21:05
Copy link
Contributor Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 4 files reviewed, 5 unresolved discussions (waiting on @golangcibot, @manishrjain, @pawanrawal, and @pullrequest[bot])


gql/parser.go, line 2843 at r2 (raw file):

Previously, pullrequest[bot] wrote…

I see this is being used as a placeholder for a blank alias. Does this field need to be set at all then? If it's required, can it be made optional?

Done.


query/outputnode.go, line 613 at r2 (raw file):

Previously, pullrequest[bot] wrote…

Do we want to look at DestUIDs here?

Done.


query/outputnode.go, line 615 at r2 (raw file):

Previously, pullrequest[bot] wrote…

Isn't UidCountAlias deprecated? I don't see another instance of this in the repo.

yes.


query/query.go, line 1135 at r1 (raw file):

Previously, golangcibot (Bot from GolangCI) wrote…

File is not gofmt-ed with -s (from gofmt)

			math.MaxUint64: {

Done.


query/query0_test.go, line 2289 at r2 (raw file):

Previously, pullrequest[bot] wrote…

TODO comments are a better way of codepaths that need to be worked on rather than commenting out code. Git will keep track of the latter for you. The former will explain why something is missing.

Done.

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 5 files at r1.
Reviewable status: 1 of 4 files reviewed, 7 unresolved discussions (waiting on @golangcibot, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])


query/query4_test.go, line 975 at r3 (raw file):

	}`
	_, err := processQuery(context.Background(), t, query)
	require.Contains(t, err.Error(), "uidcount not allowed multiple times in same sub-query")

Should the error be count(uid) not allowed ...?

Copy link
Contributor Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 4 files reviewed, 7 unresolved discussions (waiting on @golangcibot, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])


query/query4_test.go, line 975 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

Should the error be count(uid) not allowed ...?

I can add one more if to handle this case, but I feel this is also explanatory of the issue.

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nicely written from a cursory look. Have one comment. LGTM from my side. Feel free to merge once you get approval from @pawanrawal .

Reviewable status: 1 of 4 files reviewed, 8 unresolved discussions (waiting on @golangcibot, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])


query/query4_test.go, line 1085 at r3 (raw file):

			"q": [
				{
					"count": 3

What happens if I have count(uid) and count(friend) on the same level? What would the result contain as the JSON key?

Copy link
Contributor

@animesh2049 animesh2049 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 5 files at r1, 4 of 4 files at r3.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @golangcibot, @mangalaman93, @pawanrawal, and @pullrequest[bot])

Copy link
Contributor Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @golangcibot, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])


query/query4_test.go, line 1085 at r3 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

What happens if I have count(uid) and count(friend) on the same level? What would the result contain as the JSON key?

count(friend) will be handled at the child level whereas count(uid) nodes are handled at the parent. For example -

{
    q(func: has(friend)) {
         name
         count(uid)
         count(friend)
     }
}
{
  "data": {
    "q": [
      {
        "count": 3
      },
      {
        "name": "Michonne",
        "count(friend)": 5
      },
      {
        "name": "Rick Grimes",
        "count(friend)": 1
      },
      {
        "name": "Andrea",
        "count(friend)": 1
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 11096,
      "processing_ns": 13086401,
      "encoding_ns": 22698,
      "assign_timestamp_ns": 566487
    },
    "txn": {
      "start_ts": 121
    }
  }
}

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: I tried hard to find something that you might have missed but couldn't. Nicely done.

Reviewed 4 of 4 files at r3.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @golangcibot, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])

@mangalaman93 mangalaman93 merged commit 9864961 into master Oct 10, 2019
@mangalaman93 mangalaman93 deleted the aman/issue_4038 branch October 10, 2019 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants