Fold some of sig_terms into terms#57361
Merged
nik9000 merged 4 commits intoelastic:masterfrom May 29, 2020
Merged
Conversation
This merges the global-ordinals-based implementation for `significant_terms` into the global-ordinals-based implementation of `terms`, removing a bunch of copy and pasted code that is subtly different across the two implementations and replacing it with an explicit `ResultStrategy` with nice stuff like Javadoc. The actual behavior is mostly unchanged, though I was able to remove a redundant copy of bytes representing the string from the result construction phase of `significant_terms`.
Collaborator
|
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
16 tasks
not-napoleon
approved these changes
May 29, 2020
Member
not-napoleon
left a comment
There was a problem hiding this comment.
LGTM, Nice refactoring. Feels good to see these two coming more into sync.
| BytesRef apply(long ord) throws IOException; | ||
| } | ||
|
|
||
| public GlobalOrdinalsStringTermsAggregator(String name, AggregatorFactories factories, |
Member
There was a problem hiding this comment.
Nit: Maybe run the formatter on this method declaration?
| boolean showTermDocCountError, | ||
| Map<String, Object> metadata) throws IOException { | ||
| super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, metadata); | ||
| this.resultStrategy = resultStrategy.apply(this); |
Member
There was a problem hiding this comment.
Nit: Since the syntax backing this is somewhat rare in aggs, maybe toss a quick comment here that we need the reference to this in order to construct the closure? I figured it out, but did a double take when I first saw it.
| boolean showTermDocCountError, | ||
| Map<String, Object> metadata) throws IOException { | ||
| super(name, factories, valuesSource, order, format, bucketCountThresholds, null, | ||
| super(name, factories, a -> a.new StandardTermsResults(), valuesSource, order, format, bucketCountThresholds, null, |
Member
There was a problem hiding this comment.
Nit: maybe update the javadoc to say this can only be used for StandardTerms?
Member
Author
|
Thanks @not-napoleon ! I've merged and will backport! |
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
May 29, 2020
This merges the global-ordinals-based implementation for `significant_terms` into the global-ordinals-based implementation of `terms`, removing a bunch of copy and pasted code that is subtly different across the two implementations and replacing it with an explicit `ResultStrategy` with nice stuff like Javadoc. The actual behavior is mostly unchanged, though I was able to remove a redundant copy of bytes representing the string from the result construction phase of `significant_terms`.
nik9000
added a commit
that referenced
this pull request
May 30, 2020
This merges the global-ordinals-based implementation for `significant_terms` into the global-ordinals-based implementation of `terms`, removing a bunch of copy and pasted code that is subtly different across the two implementations and replacing it with an explicit `ResultStrategy` with nice stuff like Javadoc. The actual behavior is mostly unchanged, though I was able to remove a redundant copy of bytes representing the string from the result construction phase of `significant_terms`. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Jun 5, 2020
When you run a `significant_terms` aggregation on a field and it *is* mapped but there aren't any values for it then the count of the documents that match the query on that shard still have to be added to the overall doc count. I broke that in elastic#57361. This fixes that. Closes elastic#57402
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Jun 8, 2020
When you run a `significant_terms` aggregation on a field and it *is* mapped but there aren't any values for it then the count of the documents that match the query on that shard still have to be added to the overall doc count. I broke that in elastic#57361. This fixes that. Closes elastic#57402
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.
This merges the global-ordinals-based implementation for
significant_termsinto the global-ordinals-based implementation ofterms, removing a bunch of copy and pasted code that is subtlydifferent across the two implementations and replacing it with an
explicit
ResultStrategywith nice stuff like Javadoc.The actual behavior is mostly unchanged, though I was able to remove a
redundant copy of bytes representing the string from the result
construction phase of
significant_terms.