Fix incorrect calculation of how many buckets will result from a merge operation. (#44461) (#44515)

This commit is contained in:
Paul Sanwald 2019-07-17 19:14:16 -04:00 committed by GitHub
parent 8841779de8
commit 7114fe786b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -526,6 +526,9 @@ public final class InternalAutoDateHistogram extends
if (buckets.size() > targetBuckets) { if (buckets.size() > targetBuckets) {
for (int interval : roundingInfo.innerIntervals) { for (int interval : roundingInfo.innerIntervals) {
int resultingBuckets = buckets.size() / interval; int resultingBuckets = buckets.size() / interval;
if (buckets.size() % interval != 0) {
resultingBuckets++;
}
if (resultingBuckets <= targetBuckets) { if (resultingBuckets <= targetBuckets) {
return mergeConsecutiveBuckets(buckets, interval, roundingIdx, roundingInfo, reduceContext); return mergeConsecutiveBuckets(buckets, interval, roundingIdx, roundingInfo, reduceContext);
} }

View File

@ -109,9 +109,6 @@ public class InternalAutoDateHistogramTests extends InternalMultiBucketAggregati
} }
@Override
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39497")
// TODO: When resolving the above AwaitsFix, just delete this override. Method is only overriden to apply the annotation.
public void testReduceRandom() { public void testReduceRandom() {
super.testReduceRandom(); super.testReduceRandom();
} }