Skip to content

Commit e6148ec

Browse files
authored
Fix flaky exponential histogram sum aggregation test (#136819)
1 parent c832243 commit e6148ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/aggregations/metrics/ExponentialHistogramSumAggregatorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class ExponentialHistogramSumAggregatorTests extends ExponentialHistogram
4141
public void testMatchesNumericDocValues() throws IOException {
4242

4343
List<ExponentialHistogram> histograms = createRandomHistograms(randomIntBetween(1, 1000));
44-
boolean anyNonEmpty = histograms.stream().anyMatch(histo -> histo.valueCount() > 0);
44+
boolean anyNonEmpty = histograms.stream().anyMatch(histo -> histo.sum() != 0);
4545

4646
double expectedSum = histograms.stream().mapToDouble(ExponentialHistogram::sum).sum();
4747

@@ -73,7 +73,7 @@ public void testQueryFiltering() throws IOException {
7373
.map(histo -> Map.entry(histo, randomBoolean()))
7474
.toList();
7575

76-
boolean anyMatch = histogramsWithFilter.stream().filter(entry -> entry.getKey().valueCount() > 0).anyMatch(Map.Entry::getValue);
76+
boolean anyMatch = histogramsWithFilter.stream().filter(entry -> entry.getKey().sum() != 0).anyMatch(Map.Entry::getValue);
7777
double filteredSum = histogramsWithFilter.stream().filter(Map.Entry::getValue).mapToDouble(entry -> entry.getKey().sum()).sum();
7878

7979
testCase(

0 commit comments

Comments
 (0)