Skip to content

Commit

Permalink
Remove invalid asserts in MergingDigest. (#96928)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kkrik-es authored Jun 19, 2023
1 parent b508ee7 commit 2f93cf5
Showing 1 changed file with 0 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ private void merge(
) {
// when our incoming buffer fills up, we combine our existing centroids with the incoming data,
// and then reduce the centroids by merging if possible
assert lastUsedCell <= 0 || weight[0] == 1;
assert lastUsedCell <= 0 || weight[lastUsedCell - 1] == 1;
System.arraycopy(mean, 0, incomingMean, incomingCount, lastUsedCell);
System.arraycopy(weight, 0, incomingWeight, incomingCount, lastUsedCell);
incomingCount += lastUsedCell;
Expand Down

0 comments on commit 2f93cf5

Please sign in to comment.