Skip to content

Commit c3897a0

Browse files
committed
Remove subaggregator check from CompositeAggregator
Not sure why I added this, when the existing implementation didn't have it. That said, we *should* call finishLeaf() before precomputing the current leaf. Signed-off-by: Michael Froh <froh@amazon.com>
1 parent 37f02df commit c3897a0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeAggregator.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,8 @@ private void processLeafFromQuery(LeafReaderContext ctx, Sort indexSortPrefix) t
557557

558558
@Override
559559
protected boolean tryPrecomputeAggregationForLeaf(LeafReaderContext ctx) throws IOException {
560-
if (subAggregators().length == 0) {
561-
return filterRewriteOptimizationContext.tryOptimize(ctx, this::incrementBucketDocCount, segmentMatchAll(context, ctx));
562-
}
563-
return false;
560+
finishLeaf(); // May need to wrap up previous leaf if it could not be precomputed
561+
return filterRewriteOptimizationContext.tryOptimize(ctx, this::incrementBucketDocCount, segmentMatchAll(context, ctx));
564562
}
565563

566564
@Override

0 commit comments

Comments
 (0)