-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels