Repository navigation
Conversation
1f3a682 to
adf134b
Compare
|
The code is ready for review.
|
| public static <T> Iterator<T> dropWhile(Iterator<T> iter, Predicate<T> predicate) { | ||
| PeekIterator<T> iter2 = new PeekIterator<>(iter); | ||
| for(;;) { | ||
| T elt = iter2.peek(); |
There was a problem hiding this comment.
Endless loop because iterator is never advanced.
This method was used during development before settling on
iter = records.getRecordBuffer().iterator(minRecord, maxRecordPlusOne); in BPTreeDistinctKeyPrefixIterator.
rvesse
left a comment
There was a problem hiding this comment.
Hey @Aklakan this looks like a really great potential improvement. I had always thought what I'd done previously for prefix scanning had potential to be applied to other kinds of queries but never any chance to explore that further so thanks for taking this on
I have various comments across the PR, these covers three main things (plus the odd typo):
- Whether this can/should handle other aggregates like
MAX(DISTNCT ?var)since it would seem applying the distinct in the scan first wouldn't change their outputs either. - Improvements to testing, particularly around regression and scale
- Leftover TODOs which may/may not remain relevant
bd29358 to
e3ba4d2
Compare
189640a to
ec0bfd1
Compare
ea0eb86 to
974750f
Compare
|
I have completed my revision. The code is now more modular:
|
Thanks @Aklakan, I will aim to review this again later in the week |
|
@rvesse - how do the changes look to you? |
rvesse
left a comment
There was a problem hiding this comment.
This looks good to me now.
Test coverage is substantially improved which was one of my requests from my original review. Have checked out the branch and ran the new test suite locally.
Couple of minor comments
767a4fd to
6e23db1
Compare
Co-authored-by: Rob Vesse <rvesse@dotnetrdf.org>
6e23db1 to
6b422ab
Compare
|
I added the requested minor changes and had another look over the code and it still looked ok to me. So for now I'd say its done. In case a bug is revealed there is still |
|
To get up-to-speed with this PR, I did a AI code review (Claude Code, model=Opus5, effort=xhigh). It came up with some findings. I got it to generate test cases then verified some of them (1, 4 and 6 - they have test SELECT queries) by taking the data and query then using I think some of findings are the same underlying cause in appearing in different ways.
I'm not sure then best way to exchange the material. If there is a better way, please say so. I've put the material on a branch in my The code is the PR, rebased to Jena 3 commits:
Claude offered to "split into per-finding comments for posting inline on the PR (/code-review 3995 --comment does that)" if that would be helpful. |
|
Thanks for the Claude analysis. All wrong SPARQL answers were so far fixable. I am currently down to 6 failing test cases which I still need to look into - at least 2 seem to be invalid.
SELECT ?s {
{ SELECT DISTINCT ?s { ?s [] [] } }
FILTER EXISTS { ?s ?s ?s }
}
I still have to look into |
Only "short" is implemented. While NodeId is designed for 8+4, it has never been used. It woudl need testing out before use in a release as the implicit assumpt of 8 may well have leaked into some code or other. It was never intended for mixed use. One database - one size of NodeId. |
Good plan. |
Other reviewers have discovered edge cases where the new behaviour breaks
Good question - (Heh, sounds like an AI response). So the nice thing is that Claude isolated all changes - even private access - using the I am nearing completion of my fixes, the question is how to add them. perhaps i add only the fixes to this PR, and you rebase the Claude tests on top of them? So ideally the tests would eventually use e.g. package-private access rather than reflection via |
Update the PR - pick any tests that are useful. I can generate a new Claude review from scratch and it generate can tests based on the new state. This is also an option
|
73f4f08 to
2d940c5
Compare
|
I added the fixes and the test cases in a new commit and ran a review using Astra/Medium which found 4 more issues in my changes for Claude which are all fixed now and verified with additional tests. (I did not squash them yet so that the AI can track progress in the commits). The following points were raised as potential code smells, but the design choices were deliberately that way for the given reasons (in case Claude also marks them):
|
GitHub issue resolved #3994
Pull request Description: Adds skip scan evaluation for single-pattern queries to TDB2. Added special code paths to
OpExecutorTDB2forOpDistinctandOpGroupBy.Execution time to find all distinct predicates on Wikidata Truthy (8B triples) becomes between 1 and 100 seconds (warm-cold caches)
Also works for simple group by patterns such as
SELECT ?p (COUNT(DISTINCT ?g) AS ?c) { GRAPH ?g { ?s ?p ?o } } GROUP BY ?pNeed yet to add tests - such as create permutations of patterns and compare results with a reference engine (eg. ARQ).
[ ] Documentation change and updates are provided for the Apache Jena websiteBy 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.