Comprehensively test supported/unsupported field type:agg combinations#52493
Merged
polyfractal merged 8 commits intoelastic:masterfrom Feb 20, 2020
Merged
Comprehensively test supported/unsupported field type:agg combinations#52493polyfractal merged 8 commits intoelastic:masterfrom
polyfractal merged 8 commits intoelastic:masterfrom
Conversation
This adds a test to AggregatorTestCase that allows us to programmatically verify that an aggregator supports or does not support a particular field type. It fetches the list of registered field type parsers, creates a MappedFieldType from the parser and then attempts to run a basic agg against the field. A supplied list of supported VSTypes are then compared against the output (success or exception) and suceeds or fails the test accordingly.
Collaborator
|
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
polyfractal
commented
Feb 18, 2020
| return Collections.emptyList(); | ||
| } | ||
|
|
||
| public void testSupportedFieldTypes() throws IOException { |
Contributor
Author
There was a problem hiding this comment.
The meat of the PR is here.
polyfractal
commented
Feb 18, 2020
| } | ||
|
|
||
| @Override | ||
| public Builder docValues(boolean docValues) { |
Contributor
Author
There was a problem hiding this comment.
Note: we think this is a bug, I'll open a separate PR fixing this
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/search/aggregations/support/CoreValuesSourceType.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
Tidied up, added javadocs, and cleaned up the comments that were left. For posterity, we also decided to remove the CoreValuesSourceTypes that weren't in use (IP, BOOLEAN, DATE) and return the appropriate type today (BYTES/NUMERIC) so that we didn't have dead code hanging around. |
not-napoleon
approved these changes
Feb 20, 2020
Member
not-napoleon
left a comment
There was a problem hiding this comment.
Looks good, I left two small comments. Really excited to get this in!
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java
Outdated
Show resolved
Hide resolved
…ions/AggregatorTestCase.java Co-Authored-By: Mark Tozzi <mark.tozzi@gmail.com>
Contributor
Author
|
@elasticmachine run elasticsearch-ci/1 |
85 tasks
polyfractal
pushed a commit
to polyfractal/elasticsearch
that referenced
this pull request
Mar 30, 2020
elastic#52493) This adds a test to AggregatorTestCase that allows us to programmatically verify that an aggregator supports or does not support a particular field type. It fetches the list of registered field type parsers, creates a MappedFieldType from the parser and then attempts to run a basic agg against the field. A supplied list of supported VSTypes are then compared against the output (success or exception) and suceeds or fails the test accordingly. Co-Authored-By: Mark Tozzi <mark.tozzi@gmail.com> * Skip fields that are not aggregatable
polyfractal
pushed a commit
that referenced
this pull request
Mar 31, 2020
…nations (#54451) * Comprehensively test supported/unsupported field type:agg combinations (#52493) This adds a test to AggregatorTestCase that allows us to programmatically verify that an aggregator supports or does not support a particular field type. It fetches the list of registered field type parsers, creates a MappedFieldType from the parser and then attempts to run a basic agg against the field. A supplied list of supported VSTypes are then compared against the output (success or exception) and suceeds or fails the test accordingly. Co-Authored-By: Mark Tozzi <mark.tozzi@gmail.com> * Skip fields that are not aggregatable * Use newIndexSearcher() to avoid incompatible readers (#52723) Lucene's `newSearcher()` can generate readers like ParallelCompositeReader which we can't use. We need to instead use our helper `newIndexSearcher`
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 adds a test to AggregatorTestCase that allows us to programmatically verify that an aggregator supports or does not support all available field types. It fetches the list of registered field type parsers, creates a MappedFieldType from the parser and then attempts to run a basic agg against the field.
A supplied list of supported VSTypes are then compared against the output (success or exception) and suceeds or fails the test accordingly.
Still a WIP, need to tidy up, add javadocs, add another "main" agg or two (histo, etc). Putting it up in case folks want to have a look before I spend more time on it.
Note: to make this work, the PR cherry-picks over the
getValuesSourceType()component of #51503. This will be added in eventually from the VS refactor branch, but is technically "unused" code outside of the tests until then.Note 2: does not support field types added from a module at the moment.