Skip to content

Commit 262d674

Browse files
committed
Adding override for RangeAggregator as well
Signed-off-by: Ankit Jain <jainankitk@apache.org>
1 parent c967b02 commit 262d674

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

server/src/main/java/org/opensearch/search/aggregations/LeafBucketCollector.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ public void collect(DocIdStream stream) throws IOException {
145145
*/
146146
@ExperimentalApi
147147
public void collect(DocIdStream stream, long owningBucketOrd) throws IOException {
148+
// Different aggregator implementations should override this method even if to just delegate to super for
149+
// helping the performance: when the super call inlines, calls to #collect(int, long) become monomorphic.
148150
stream.forEach((doc) -> collect(doc, owningBucketOrd));
149151
}
150152

server/src/main/java/org/opensearch/search/aggregations/bucket/range/RangeAggregator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import org.apache.lucene.index.LeafReaderContext;
3535
import org.apache.lucene.search.DocIdSetIterator;
36+
import org.apache.lucene.search.DocIdStream;
3637
import org.apache.lucene.search.ScoreMode;
3738
import org.apache.lucene.util.FixedBitSet;
3839
import org.opensearch.core.ParseField;
@@ -353,6 +354,11 @@ public void collect(int doc, long bucket) throws IOException {
353354
}
354355
}
355356

357+
@Override
358+
public void collect(DocIdStream stream, long owningBucketOrd) throws IOException {
359+
super.collect(stream, owningBucketOrd);
360+
}
361+
356362
private int collect(int doc, double value, long owningBucketOrdinal, int lowBound) throws IOException {
357363
MatchedRange range = new MatchedRange(ranges, lowBound, value, maxTo);
358364
for (int i = range.startLo; i <= range.endHi; ++i) {

0 commit comments

Comments
 (0)