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

HAVING clause should not require parentheses when involving AND or OR #111

Open
rogerlucena opened this issue Jul 4, 2020 · 0 comments
Open

Comments

@rogerlucena
Copy link
Contributor

When using a HAVING clause, it should not be required for the expressions around AND or OR operators to be surrounded by parentheses.

To illustrate, nowadays the following query in BQL works:

SELECT ?parent_name, ?child_name, ?child_height
FROM ?family
WHERE {
  ?parent ID ?parent_name "parent_of"@[] ?child ID ?child_name .
  ?child "height_cm"@[] ?child_height
}
HAVING (?child_height > "150"^^type:int64) AND (?parent = /u<peter>);

But the following does not:

SELECT ?parent_name, ?child_name, ?child_height
FROM ?family
WHERE {
  ?parent ID ?parent_name "parent_of"@[] ?child ID ?child_name .
  ?child "height_cm"@[] ?child_height
}
HAVING ?child_height > "150"^^type:int64 AND ?parent = /u<peter>;

It yields the following error:

[FAIL] [ERROR] Failed to parse BQL statement with error Parser.parse: Failed to consume symbol HAVING, with error failed to consume all token; left over [{false  0xc00021af50} {false  0xc00021afa0} {false  0xc00021aff0} {false  0xc00021b040}]

This may be related with the NewEvaluator inside expression.go in semantics, as the grammar is not the one restricting this behavior.

You can use the code in the file below to reproduce the aforementioned results.

parentheses_in_having.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant