-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace AggregatorTestCase#search with AggregatorTestCase#searchAndReduce #60683
Replace AggregatorTestCase#search with AggregatorTestCase#searchAndReduce #60683
Conversation
…duce This commit removes the ability to test the top level result of an aggregator before it runs the final reduce. All aggregator tests that use AggregatorTestCase#search are rewritten with AggregatorTestCase#searchAndReduce in order to ensure that we test the final output (the one sent to the end user) rather than an intermediary result that could be different. This change also removes spurious commits triggered on top of a random index writer. These commits slow down the tests and are redundant with the commits that the random index writer performs.
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Please clean up that one for loop that got missed, otherwise 👍
@@ -451,7 +450,8 @@ private void mergeBucketsWithPlan(List<Bucket> buckets, List<BucketRange> plan, | |||
} | |||
toMerge.add(buckets.get(startIdx)); // Don't remove the startIdx bucket because it will be replaced by the merged bucket | |||
|
|||
reduceContext.consumeBucketsAndMaybeBreak(- (toMerge.size() - 1)); | |||
int toRemove = toMerge.stream().mapToInt(b -> countInnerBucket(b)+1).sum(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an actual bug you found while making this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor one, yes. The max bucket count is not accurate when buckets are auto-merged.
...src/test/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregatorTests.java
Outdated
Show resolved
Hide resolved
...va/org/elasticsearch/search/aggregations/bucket/histogram/RangeHistogramAggregatorTests.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for the auto date histo and variable width histo I'll miss being able to assert on things that aren't yet finally reduced, but it is worth it.
This commit fixes the computation of the subset size on empty buckets (doc count of 0). The aggregator test refactoring in elastic#60683 revealed this bug.
This commit fixes the computation of the subset size on empty buckets (doc count of 0). The aggregator test refactoring in #60683 revealed this bug.
This commit fixes the computation of the subset size on empty buckets (doc count of 0). The aggregator test refactoring in #60683 revealed this bug.
With #60683 we stopped forcing aggregating all docs using a single Aggregator which made some of our accuracy assumptions about the stats aggregator incorrect. This adds a test that does the forcing and asserts the old accuracy and adds a test without the forcing with much looser accuracy guarantees. Closes #61132
With #60683 we stopped forcing aggregating all docs using a single Aggregator which made some of our accuracy assumptions about the stats aggregator incorrect. This adds a test that does the forcing and asserts the old accuracy and adds a test without the forcing with much looser accuracy guarantees. Closes #61132
This commit removes the ability to test the top level result of an aggregator
before it runs the final reduce. All aggregator tests that use AggregatorTestCase#search
are rewritten with AggregatorTestCase#searchAndReduce in order to ensure that we test
the final output (the one sent to the end user) rather than an intermediary result
that could be different.
This change also removes spurious commits triggered on top of a random index writer.
These commits slow down the tests and are redundant with the commits that the
random index writer performs.