GH 1868 zero-length paths must not match absent nodes#4032
GH 1868 zero-length paths must not match absent nodes#4032ThomasThelen wants to merge 2 commits into
Conversation
rvesse
left a comment
There was a problem hiding this comment.
Fix looks quite straightforward and elegant to me, it's been a while since I've been delving in the SPARQL engine internals so I will leave this open for now to give others with fresher eyes chance to review before merging
|
I'd like time to explore all the possibilities with complex paths to convince myself that pulling the test up to the evaluation is always correct. (Finding clear "think" time is hard.) |
| protected static final int hashShortest = 0x205 ; | ||
|
|
||
|
|
||
| // Return true if this path can match in zero steps |
There was a problem hiding this comment.
This isn't necessary because it is a default method in the interface.
(and it generates a warning because there is no @Override.)
There was a problem hiding this comment.
Thanks for catching this - I made the change and squashed it into 90b64bf.
Co-authored-by: Andy Seaborne <andy@apache.org>
|
Thanks for the feedback here! For more context here's this gist of what my original implementation was like - but it felt way too heavy for how often this gets called, hence hardcoding the true/false values into the classes themselves. In PathLib.java I had, |
GitHub issue resolved #1868
Pull request Description:
This is a bit of an experimental path taken. Initially I had done this with a longer walking of the AST and realized that the performance hit would be too big because
evalGroundedPathgets called on each binding.Instead, the approach that I took here is to hardcode the zero length component state as part of the various path classes, culminating in the dispatch to evalGroundedPath. This should get called once rather than the n times for each row in my previous AST implementation.
Happy to provide performance tests, address feedback, or close this if it's a bit far fetched.
By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.
See the Apache Jena "Contributing" guide.