-
Notifications
You must be signed in to change notification settings - Fork 169
Gh 5286 leftjoin skip rhs execution #5318
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
base: main
Are you sure you want to change the base?
Gh 5286 leftjoin skip rhs execution #5318
Conversation
This benchmark shows a significant improvement in query performance when the optional contains a filter that can be evaluated with only the left hand side and leads to false in most, but not all cases. Before
After
|
This benchmark shows there is no significant increase in query performance when the optional contains a filter that needs to be evaluated with the right hand side. Before
After
|
@hmottestad, @JervenBolleman, would this be something we could incorporate in RDF4J? We have some queries that benefit from this optimisation. |
6cd5e45
to
273ed8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copyright year needs to be 2025
...lipse/rdf4j/query/algebra/evaluation/impl/evaluationsteps/PostFilterQueryEvaluationStep.java
Show resolved
Hide resolved
|
||
@Override | ||
public CloseableIteration<BindingSet> evaluate(BindingSet leftBindings) { | ||
var rightIteration = wrapped.evaluate(leftBindings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for myself: did we start using var in the code base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with var. I've started using it where it makes sense. Best use case for me so far has been for connections or iterators that are wrapped in a try-with-resource, much easier to read.
Do not evaluate the right hand side when the condition can be evaluated with only left hand side bindings and evaluates to false.
…ll designed queries statically
273ed8e
to
db12fd1
Compare
@jasperiq just waiting for the one comment, then I think it LGTM :) Thank you very much for your contribution and patience. |
That's fine! I'm under the assumption that I have completed the requested changes. If my assumption is incorrect and there is anything I need to do, please let me know. |
GitHub issue resolved: #5286
Briefly describe the changes proposed in this PR:
This PR skips the right hand side execution when an optional (left join) contains a filter that can be evaluated only with the left hand side and this evaluation returns false.
Benchmark results are added as separate comments
PR Author Checklist (see the contributor guidelines for more details):
mvn process-resources
to format from the command line)