Skip to content

Commit 2f93cf5

Browse files
authored
Remove invalid asserts in MergingDigest. (#96928)
The asserts were misfiring in this test: ``` REPRODUCE WITH: ./gradlew ':server:test' --tests "org.elasticsearch.search.aggregations.metrics.InternalMedianAbsoluteDeviationTests.testReduceRandom" -Dtests.seed=AA1D81AD056870F0 -Dtests.locale=en-CA -Dtests.timezone=US/Eastern -Druntime.java=20 org.elasticsearch.search.aggregations.metrics.InternalMedianAbsoluteDeviationTests > testReduceRandom FAILED java.lang.AssertionError at __randomizedtesting.SeedInfo.seed([AA1D81AD056870F0:6A202DBC2335E9A6]:0) at org.elasticsearch.tdigest.MergingDigest.merge(MergingDigest.java:316) at org.elasticsearch.tdigest.MergingDigest.mergeNewValues(MergingDigest.java:298) at org.elasticsearch.tdigest.MergingDigest.mergeNewValues(MergingDigest.java:288) at org.elasticsearch.tdigest.MergingDigest.quantile(MergingDigest.java:485) at org.elasticsearch.tdigest.HybridDigest.quantile(HybridDigest.java:141) at org.elasticsearch.search.aggregations.metrics.TDigestState.quantile(TDigestState.java:247) at org.elasticsearch.search.aggregations.metrics.InternalMedianAbsoluteDeviation.computeMedianAbsoluteDeviation(InternalMedianAbsoluteDeviation.java:38) at org.elasticsearch.search.aggregations.metrics.InternalMedianAbsoluteDeviation.<init>(InternalMedianAbsoluteDeviation.java:48) at org.elasticsearch.search.aggregations.metrics.InternalMedianAbsoluteDeviationTests.createTestInstance(InternalMedianAbsoluteDeviationTests.java:33) at org.elasticsearch.search.aggregations.metrics.InternalMedianAbsoluteDeviationTests.createTestInstance(InternalMedianAbsoluteDeviationTests.java:23) ``` They should have been removed earlier, it's possible for the first and the last centroid to have weight > 1. Related to #95903
1 parent b508ee7 commit 2f93cf5

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

libs/tdigest/src/main/java/org/elasticsearch/tdigest/MergingDigest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ private void merge(
313313
) {
314314
// when our incoming buffer fills up, we combine our existing centroids with the incoming data,
315315
// and then reduce the centroids by merging if possible
316-
assert lastUsedCell <= 0 || weight[0] == 1;
317-
assert lastUsedCell <= 0 || weight[lastUsedCell - 1] == 1;
318316
System.arraycopy(mean, 0, incomingMean, incomingCount, lastUsedCell);
319317
System.arraycopy(weight, 0, incomingWeight, incomingCount, lastUsedCell);
320318
incomingCount += lastUsedCell;

0 commit comments

Comments
 (0)