Fix test bug in auto_date_histo

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
This commit is contained in:
Nik Everett 2020-07-07 13:55:24 -04:00
parent e343e066fc
commit d536854879
1 changed files with 1 additions and 1 deletions

View File

@ -155,7 +155,7 @@ public class InternalAutoDateHistogramTests extends InternalMultiBucketAggregati
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;