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

return error if keywords used as alias in groupby #3725

Merged
merged 3 commits into from
Sep 17, 2019

Conversation

poonai
Copy link
Contributor

@poonai poonai commented Jul 25, 2019

Signed-off-by: பாலாஜி ஜின்னா [email protected]


This change is Reviewable

@poonai poonai requested review from manishrjain and a team as code owners July 25, 2019 11:30
@poonai poonai requested a review from pawanrawal July 25, 2019 11:30
Signed-off-by: பாலாஜி ஜின்னா <[email protected]>
@poonai poonai force-pushed the balaji/alias_error branch from 860dc04 to 2ccb745 Compare July 25, 2019 11:32
Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

:lgtm: Just a couple of minor comments.

Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @manishrjain, @pawanrawal, and @Sch00lb0y)


gql/parser.go, line 1952 at r1 (raw file):

				}
				if validKey(val) {
					return item.Errorf("Can't use %s as alias.", val)

minor: no period at the end of error messages (to match the go convention for fmt.Errorf).


gql/parser_test.go, line 3028 at r1 (raw file):

	query {
		me(func: uid(0x1)) {
			friends @groupby(first: 10, SchooL: school) {

minor: I'd write this as friends @groupby(first: school) {. Otherwise it's unclear that first is an alias for a predicate. Right now it looks like first is another argument passed to groupby.

Copy link

@gitlw gitlw left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @manishrjain, @pawanrawal, and @Sch00lb0y)

gql/parser.go Outdated
@@ -1948,6 +1948,9 @@ func parseGroupby(it *lex.ItemIterator, gq *GraphQuery) error {
if alias != "" {
return item.Errorf("Expected predicate after %s:", alias)
}
if validKey(val) {
return item.Errorf("Can't use %s as alias.", val)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe say "Can't use keyword %s as alias in groupby."

@campoy
Copy link
Contributor

campoy commented Sep 13, 2019

What happened to this PR, @balajijinnah ?

பாலாஜி ஜின்னா added 2 commits September 17, 2019 03:57
Signed-off-by: பாலாஜி ஜின்னா <[email protected]>
Signed-off-by: பாலாஜி ஜின்னா <[email protected]>
@mangalaman93 mangalaman93 merged commit 19ed1d1 into master Sep 17, 2019
@mangalaman93 mangalaman93 deleted the balaji/alias_error branch September 17, 2019 11:38
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