Skip to content

Commit

Permalink
Finally fixing hardbounds test case
Browse files Browse the repository at this point in the history
Signed-off-by: Ankit Jain <akjain@amazon.com>
  • Loading branch information
jainankitk committed Nov 27, 2023
1 parent 4c3b917 commit b535934
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class DateHistogramAggregator extends BucketsAggregator implements SizedBucketAg
// Update min/max limit if user specified any hard bounds
if (hardBounds != null) {
bounds[0] = Math.max(bounds[0], hardBounds.getMin());
bounds[1] = Math.min(bounds[1], hardBounds.getMax());
bounds[1] = Math.min(bounds[1], hardBounds.getMax() - 1); // hard bounds max is exclusive
}

filters = FilterRewriteHelper.createFilterForAggregations(
Expand Down Expand Up @@ -286,18 +286,20 @@ private boolean tryFastFilterAggregation(LeafReaderContext ctx, long owningBucke
}

for (i = 0; i < filters.length; i++) {
long bucketOrd = bucketOrds.add(
owningBucketOrd,
preparedRounding.round(
fieldType.convertNanosToMillis(
NumericUtils.sortableBytesToLong(((PointRangeQuery) filters[i].getQuery()).getLowerPoint(), 0)
if (counts[i] > 0) {
long bucketOrd = bucketOrds.add(
owningBucketOrd,
preparedRounding.round(
fieldType.convertNanosToMillis(
NumericUtils.sortableBytesToLong(((PointRangeQuery) filters[i].getQuery()).getLowerPoint(), 0)
)
)
)
);
if (bucketOrd < 0) { // already seen
bucketOrd = -1 - bucketOrd;
);
if (bucketOrd < 0) { // already seen
bucketOrd = -1 - bucketOrd;
}
incrementBucketDocCount(bucketOrd, counts[i]);
}
incrementBucketDocCount(bucketOrd, counts[i]);
}
throw new CollectionTerminatedException();
}
Expand Down

0 comments on commit b535934

Please sign in to comment.