Skip to content
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

Backport/backport 15194 to 2.16 #15286

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add segment match all guard for range aggregator
Signed-off-by: Finn Carroll <[email protected]>
finnegancarroll committed Aug 16, 2024

Verified

This commit was signed with the committer’s verified signature.
commit a762cb161072f04aa6e625a2087629c82e67c601
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@
import java.util.function.BiConsumer;

import static org.opensearch.core.xcontent.ConstructingObjectParser.optionalConstructorArg;
import static org.opensearch.search.aggregations.bucket.FastFilterRewriteHelper.segmentMatchAll;

/**
* Aggregate all docs that match given ranges.
@@ -298,12 +299,12 @@ public ScoreMode scoreMode() {

@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBucketCollector sub) throws IOException {
boolean optimized = fastFilterContext.tryFastFilterAggregation(
if (segmentMatchAll(context, ctx) && fastFilterContext.tryFastFilterAggregation(
ctx,
this::incrementBucketDocCount,
(activeIndex) -> subBucketOrdinal(0, (int) activeIndex)
);
if (optimized) throw new CollectionTerminatedException();
(activeIndex) -> subBucketOrdinal(0, (int) activeIndex))) {
throw new CollectionTerminatedException();
}

final SortedNumericDoubleValues values = valuesSource.doubleValues(ctx);
return new LeafBucketCollectorBase(sub, values) {