Skip to content
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

Fixing testComplicatedBucketPath for avg bucket agg #87161

Merged
merged 2 commits into from
May 26, 2022

Conversation

benwtrent
Copy link
Member

The test was erroneously creating a test Lucene index reader directly. This means that sometimes the reader was wrapped as a Parallel (threaded) reader which we don't support yet.

This commit cleans up the test and uses AggregatorTestCase#newIndexSearcher directly.

closes #87155

@benwtrent benwtrent added >test Issues or PRs that are addressing/adding tests :Analytics/Aggregations Aggregations v8.4.0 labels May 26, 2022
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 26, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

Comment on lines -175 to -195
avgResult = searchAndReduce(
indexSearcher,
query,
avgBuilder,
10000,
new MappedFieldType[] { fieldType, valueFieldType, keywordField }
);
histogramResult = searchAndReduce(
indexSearcher,
query,
histo,
10000,
new MappedFieldType[] { fieldType, valueFieldType, keywordField }
);
internalTerms = searchAndReduce(
indexSearcher,
query,
termsBuilder,
10000,
new MappedFieldType[] { fieldType, valueFieldType, keywordField }
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reading the test, I realized that none of these were necessary. Cleaning up.

try (IndexReader indexReader = DirectoryReader.open(directory)) {
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key change. I was using the newSearcher method from lucene tests which randomly wraps it as a parallel reader, which we don't support.

Copy link
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benwtrent benwtrent merged commit 806288b into elastic:master May 26, 2022
@benwtrent benwtrent deleted the test/fixing-avg-bucket-test branch May 26, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] AvgBucketAggregatorTests testComplicatedBucketPath failing
3 participants