-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix filter by filter execution with doc_count #68930
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
Conversation
This fixed "filter by filter" execution order so it doesn't ignore `doc_count`. The "filter by filter" execution is fairly performance sensitive but when I reran performance numbers everything looked fine.
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
| - match: { aggregations.f.buckets.foo.doc_count: 8 } | ||
| - match: { aggregations.f.buckets.xyz.doc_count: 5 } | ||
| - match: { profile.shards.0.aggregations.0.type: FiltersAggregator.FilterByFilter } | ||
| - gte: { profile.shards.0.aggregations.0.debug.segments_with_doc_count: 1 } |
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 figure it'll be nice to see this in the profile so if it is 0 we can know we didn't need to do anything fancy to get the doc count.
|
|
||
| @Override | ||
| public String toString() { | ||
| return "doc counts are " + (alwaysOne() ? "always one" : "based on " + docCountPostings); |
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 used this while debugging. We certainly don't need it but if folks don't object I'd like to keep it. I'm sure I'll bump into this class later on and this helps.
| Counter counter = new Counter(docCountProvider); | ||
| if (false == docCountProvider.alwaysOne()) { | ||
| segmentsWithDocCount++; | ||
| } |
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.
It's possible to use a different Counter implementation that always returns 1 when the provider will always return one. I trust the jvm to inline the calls on it regardless because counter is effectively final. It'd save a couple of comparisons in this very very hot section. But performance tests seemed fine so I didn't end up doing it.
csoulios
left a comment
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.
LGTM. Thanks Nik!
|
Thanks @not-napoleon and @csoulios! I've merged and will backport. |
This fixed "filter by filter" execution order so it doesn't ignore
doc_count. The "filter by filter" execution is fairly performancesensitive but when I reran performance numbers everything looked fine.