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
Change nested agg to execute in doc id order #8454
Conversation
if (childDocs.docID() > prevParentDoc) { | ||
childDocId = childDocs.docID(); | ||
} else { | ||
childDocId = childDocs.advance(prevParentDoc); | ||
} | ||
} |
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 think
if (prevParentDoc == -1) {
childDocId = childDocs.nextDoc();
} else {
if (childDocs.docID() > prevParentDoc) {
childDocId = childDocs.docID();
} else {
childDocId = childDocs.advance(prevParentDoc);
}
}
could just be replaced with
if (childDocs.docID() > prevParentDoc) {
childDocId = childDocs.docID();
} else {
childDocId = childDocs.advance(prevParentDoc + 1);
}
?
(No more check that the previous parent doc is -1, and advance to prevParentDoc+1
instead of prevParentDoc
)
@martijnvg I like the change and just left one minor comment about a potential simplification. |
20bfb27
to
452476b
Compare
@jpountz I updated the PR with your simplification and it looks much better now! |
LGTM, thanks @martijnvg ! |
452476b
to
1957262
Compare
…sed bitset in `nested` agg. Also the nested agg now requires docs to be consumed / scored in order. Closes elastic#8454
1957262
to
5c7614f
Compare
…sed bitset in `nested` agg. Also the nested agg now requires docs to be consumed / scored in order. Closes #8454
…sed bitset in `nested` agg. Also the nested agg now requires docs to be consumed / scored in order. Closes #8454
… the same parent doc id. This bug was introduced by elastic#8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small. Closes elastic#9317 Closes elastic#9346
… the same parent doc id. This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small. Closes #9317 Closes #9346
… the same parent doc id. This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small. Closes #9317 Closes #9346
… the same parent doc id. This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small. Closes #9317 Closes #9346
…sed bitset in `nested` agg. Also the nested agg now requires docs to be consumed / scored in order. Closes elastic#8454
… the same parent doc id. This bug was introduced by elastic#8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small. Closes elastic#9317 Closes elastic#9346
By executing in docid order the child level filters don't require random access bitset any more and can use normal docid set iterators. Also the child filters don't need the bitset cache anymore and can rely on the normal filter cache.
Note: PR is against 1.x branch