Skip to content

Commit 44bbcb3

Browse files
committed
Minor changes
Signed-off-by: Asim Mahmood <asim.seng@gmail.com>
1 parent a7acf06 commit 44bbcb3

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

server/src/main/java/org/opensearch/search/aggregations/bucket/HistogramSkiplistLeafCollector.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ public class HistogramSkiplistLeafCollector extends LeafBucketCollector {
3535
private final NumericDocValues values;
3636
private final DocValuesSkipper skipper;
3737
private final LeafBucketCollector sub;
38+
private final boolean isSubNoOp;
3839
private final BucketsAggregator aggregator;
3940

4041
/**
4142
* Supplier function to get the current preparedRounding from the parent aggregator.
4243
* This allows detection of rounding changes in AutoDateHistogramAggregator.
4344
*/
4445
private final LongFunction<Rounding.Prepared> preparedRoundingSupplier;
45-
private final java.util.function.Supplier<LongKeyedBucketOrds> bucketOrdsSupplier;
46+
private final Supplier<LongKeyedBucketOrds> bucketOrdsSupplier;
4647
private final IncreaseRoundingIfNeeded increaseRoundingIfNeeded;
4748

4849
/**
@@ -75,13 +76,7 @@ public HistogramSkiplistLeafCollector(
7576
LeafBucketCollector sub,
7677
BucketsAggregator aggregator
7778
) {
78-
this.values = values;
79-
this.skipper = skipper;
80-
this.preparedRoundingSupplier = (owningBucketOrd) -> preparedRounding;
81-
this.bucketOrdsSupplier = () -> bucketOrds;
82-
this.sub = sub;
83-
this.aggregator = aggregator;
84-
this.increaseRoundingIfNeeded = (owningBucketOrd, rounded) -> {};
79+
this(values, skipper, (owningBucketOrd) -> preparedRounding, () -> bucketOrds, sub, aggregator, (owningBucketOrd, rounded) -> {});
8580
}
8681

8782
/**
@@ -101,6 +96,7 @@ public HistogramSkiplistLeafCollector(
10196
this.preparedRoundingSupplier = preparedRoundingSupplier;
10297
this.bucketOrdsSupplier = bucketOrdsSupplier;
10398
this.sub = sub;
99+
this.isSubNoOp = (sub == NO_OP_COLLECTOR);
104100
this.aggregator = aggregator;
105101
this.increaseRoundingIfNeeded = increaseRoundingIfNeeded;
106102
}
@@ -199,7 +195,7 @@ public void collect(DocIdStream stream, long owningBucketOrd) throws IOException
199195
}
200196

201197
if (upToSameBucket) {
202-
if (sub == NO_OP_COLLECTOR) {
198+
if (isSubNoOp) {
203199
// stream.count maybe faster when we don't need to handle sub-aggs
204200
long count = stream.count(upToExclusive);
205201
aggregator.incrementBucketDocCount(upToBucketIndex, count);

server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ protected LeafBucketCollector getLeafCollector(SortedNumericDocValues values, Do
438438
sub,
439439
FromSingle.this,
440440
(owningBucket, rounded) -> increaseRoundingIfNeeded(rounded) // Pass supplier to allow rounding change
441-
// detectionincreaseRoundingIfNeeded
442441
);
443442
}
444443

0 commit comments

Comments
 (0)