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

Introduce TwoPhaseCollector to leverage ContextIndexSearcher in AggregatorTestCase #98835

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Aug 24, 2023

In oder to leverage the call of postcollection in the ContextIndexSearcher, we need to introduce an abstraction that can be leverage by AggregatorTestCase. Therefore we introduce the TwoPhaseCollector which simplifies a bit the code and allow to create those collector in the AggregatorTestCase.

relates #98672

@iverase iverase added >non-issue :Analytics/Aggregations Aggregations :Search/Search Search-related issues that do not fall into other categories v8.11.0 labels Aug 24, 2023
@iverase iverase requested a review from martijnvg August 24, 2023 09:12
@elasticsearchmachine elasticsearchmachine added Team:Search Meta label for search team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Aug 24, 2023
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Left two questions. LGTM - I think the TwoPhaseCollector actually cleans post collection up a bit and bring unit tests a little closer to reality.

} else if (aggsCollector instanceof InternalProfileCollector profileCollector) {
profileCollector.doPostCollection();
if (aggsCollector instanceof TwoPhaseCollector twoPhaseCollector) {
twoPhaseCollector.doPostCollection();
Copy link
Member

Choose a reason for hiding this comment

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

Should aggsCollector always be a TwoPhaseCollector? Since BucketCollectorWrapper and InternalProfileCollector implement that interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but trying to exploit that was a headache because some tests are abusing the Collector interface so I am leaving this for a follow up

@@ -181,6 +181,11 @@ public boolean supportsSampling() {
return true;
}

@Override
public boolean supportsParallelCollection() {
Copy link
Member

Choose a reason for hiding this comment

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

I assume that this agg didn't support parallel collection also before this change?

Copy link
Contributor Author

@iverase iverase Aug 24, 2023

Choose a reason for hiding this comment

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

Indeed, the postcollection method is accessing doc values created in the coordinating thread.

@iverase iverase merged commit 2cf07f6 into elastic:main Aug 24, 2023
@iverase iverase deleted the TwoPhaseCollector branch August 24, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >non-issue :Search/Search Search-related issues that do not fall into other categories Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Meta label for search team v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants