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 predicate binding equalities inside HAVING clauses #137

Merged
merged 10 commits into from
Aug 25, 2020

Conversation

rogerlucena
Copy link
Contributor

We can now compare a predicate binding to a predicate literal inside the HAVING clause (only equalities allowed) to filter the results of our query.

To illustrate, the following query is now possible:

SELECT ?s, ?p, ?o
FROM ?test
WHERE {
    ?s ?p ?o
}
HAVING ?p = "height_cm"@[];

Note that predicate inequalities are not allowed because their behavior may become confusing for the user (especially when time anchors come on stage). In this case an error is prompted orienting to extract bindings with the ID/AT keywords and to use these bindings to proceed with the comparisons in a clearer way.

bql/semantic/expression.go Show resolved Hide resolved
Copy link

@Tati1701 Tati1701 left a comment

Choose a reason for hiding this comment

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

Minor style comments, otherwise good to go :)
Please resolve them before submitting. Feel free to reach out if you have any questions.

bql/planner/planner_test.go Outdated Show resolved Hide resolved
bql/planner/planner_test.go Outdated Show resolved Hide resolved
bql/semantic/expression.go Show resolved Hide resolved
bql/semantic/expression.go Outdated Show resolved Hide resolved
bql/semantic/expression_test.go Outdated Show resolved Hide resolved
@thiagovas thiagovas merged commit 98d3b79 into google:master Aug 25, 2020
@rogerlucena rogerlucena deleted the predicate-equality-having branch August 25, 2020 18:49
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

Successfully merging this pull request may close these issues.

None yet

4 participants