Fix an optimization in terms agg#57438
Merged
nik9000 merged 2 commits intoelastic:masterfrom Jun 2, 2020
Merged
Conversation
When the `terms` agg runs against strings and uses global ordinals it has an optimization when it collects segments that only ever have a single value for the particular string. This is *very* common. But I broke it in elastic#57241. This fixes that optimization and adds `debug` information that you can use to see how often we collect segments of each type. And adds a test to make sure that I don't break the optimization again. We also had a specialiation for when there isn't a filter on the terms to aggregate. I had removed that specialization in elastic#57241 which resulted in some slow down as well. This adds it back but in a more clear way. And, hopefully, a way that is marginally faster when there *is* a filter. Closes elastic#57407
Collaborator
|
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
Member
Author
|
I've labeled this non-issue because it fixes a unreleased performance regression. Thanks for finding it @dliappis ! |
16 tasks
not-napoleon
approved these changes
Jun 2, 2020
Member
not-napoleon
left a comment
There was a problem hiding this comment.
LGTM. If at some point you'd like to make a flow chart of what choices terms makes to decide on its leaf collector implementation, I'd find that helpful.
Member
Author
Good call! |
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Jun 2, 2020
When the `terms` agg runs against strings and uses global ordinals it has an optimization when it collects segments that only ever have a single value for the particular string. This is *very* common. But I broke it in elastic#57241. This fixes that optimization and adds `debug` information that you can use to see how often we collect segments of each type. And adds a test to make sure that I don't break the optimization again. We also had a specialiation for when there isn't a filter on the terms to aggregate. I had removed that specialization in elastic#57241 which resulted in some slow down as well. This adds it back but in a more clear way. And, hopefully, a way that is marginally faster when there *is* a filter. Closes elastic#57407
nik9000
added a commit
that referenced
this pull request
Jun 2, 2020
When the `terms` agg runs against strings and uses global ordinals it has an optimization when it collects segments that only ever have a single value for the particular string. This is *very* common. But I broke it in #57241. This fixes that optimization and adds `debug` information that you can use to see how often we collect segments of each type. And adds a test to make sure that I don't break the optimization again. We also had a specialiation for when there isn't a filter on the terms to aggregate. I had removed that specialization in #57241 which resulted in some slow down as well. This adds it back but in a more clear way. And, hopefully, a way that is marginally faster when there *is* a filter. Closes #57407
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Jun 2, 2020
nik9000
added a commit
that referenced
this pull request
Jun 2, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the
termsagg runs against strings and uses global ordinals ithas an optimization when it collects segments that only ever have a
single value for the particular string. This is very common. But I
broke it in #57241. This fixes that optimization and adds
debuginformation that you can use to see how often we collect segments of
each type. And adds a test to make sure that I don't break the
optimization again.
We also had a specialiation for when there isn't a filter on the terms
to aggregate. I had removed that specialization in #57241 which resulted
in some slow down as well. This adds it back but in a more clear way.
And, hopefully, a way that is marginally faster when there is a
filter.
Closes #57407