Skip to content

Commit

Permalink
Fix test bug in auto_date_histo
Browse files Browse the repository at this point in the history
The test would try to prepare a `Rounding` even when there aren't any
buckets. This would fail because there is no range over which to prepare
the rounding. It turns out that we don't need the rounding in that case
so we just use `null` then.

Closes #59131
  • Loading branch information
nik9000 committed Jul 7, 2020
1 parent e343e06 commit d536854
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected void assertReduced(InternalAutoDateHistogram reduced, List<InternalAut

int roundingIndex = reduced.getBucketInfo().roundingIdx;
RoundingInfo roundingInfo = AutoDateHistogramAggregationBuilder.buildRoundings(null, null)[roundingIndex];
Rounding.Prepared prepared = roundingInfo.rounding.prepare(lowest, highest);
Rounding.Prepared prepared = totalBucketConut > 0 ? roundingInfo.rounding.prepare(lowest, highest) : null;

long normalizedDuration = (highest - lowest) / roundingInfo.getRoughEstimateDurationMillis();
int innerIntervalIndex = 0;
Expand Down

0 comments on commit d536854

Please sign in to comment.