-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Remove aggregation's postCollect phase #64016
Changes from 6 commits
31bbf53
93db739
e9c80e8
1e86474
9b8f630
9ea6f51
a9ae3d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,12 +142,12 @@ public interface BucketComparator { | |
|
||
/** | ||
* Build the results of this aggregation. | ||
* @param owningBucketOrds the ordinals of the buckets that we want to | ||
* @param ordsToCollect the ordinals of the buckets that we want to | ||
* collect from this aggregation | ||
* @return the results for each ordinal, in the same order as the array | ||
* of ordinals | ||
*/ | ||
public abstract InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a more clear variable name. I made this change in a dead end when I was working on this change locally but I kind of like it. |
||
public abstract InternalAggregation[] buildAggregations(long[] ordsToCollect) throws IOException; | ||
|
||
/** | ||
* Build the result of this aggregation if it is at the "top level" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,6 @@ static class Entry { | |
protected PackedLongValues.Builder docDeltasBuilder; | ||
protected PackedLongValues.Builder bucketsBuilder; | ||
protected long maxBucket = -1; | ||
protected boolean finished = false; | ||
protected LongHash selectedBuckets; | ||
|
||
/** | ||
|
@@ -136,20 +135,12 @@ public void preCollection() throws IOException { | |
collector.preCollection(); | ||
} | ||
|
||
@Override | ||
public void postCollection() throws IOException { | ||
finishLeaf(); | ||
finished = true; | ||
} | ||
|
||
/** | ||
* Replay the wrapped collector, but only on a selection of buckets. | ||
*/ | ||
@Override | ||
public void prepareSelectedBuckets(long... selectedBuckets) throws IOException { | ||
if (finished == false) { | ||
throw new IllegalStateException("Cannot replay yet, collection is not finished: postCollect() has not been called"); | ||
} | ||
finishLeaf(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty happy about how this turned out! No more |
||
if (this.selectedBuckets != null) { | ||
throw new IllegalStateException("Already been replayed"); | ||
} | ||
|
@@ -201,7 +192,6 @@ public void prepareSelectedBuckets(long... selectedBuckets) throws IOException { | |
// continue with the following leaf | ||
} | ||
} | ||
collector.postCollection(); | ||
} | ||
|
||
/** | ||
|
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 renamed this method to make it a bit more clear what it is for.