-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.search.internal; | ||
|
||
import org.apache.lucene.search.Collector; | ||
|
||
import java.io.IOException; | ||
|
||
/** A {@link Collector} extension that allows to run a post-collection phase. This phase | ||
* is run on the same thread as the collection phase. */ | ||
public interface TwoPhaseCollector extends Collector { | ||
|
||
/** | ||
* run post-collection phase | ||
*/ | ||
void doPostCollection() throws IOException; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,11 @@ public boolean supportsSampling() { | |
return true; | ||
} | ||
|
||
@Override | ||
public boolean supportsParallelCollection() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
return false; | ||
} | ||
|
||
@Override | ||
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metadata) { | ||
return new FrequentItemSetsAggregationBuilder(name, fields, minimumSupport, minimumSetSize, size, filter, executionHint); | ||
|
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.
Should
aggsCollector
always be aTwoPhaseCollector
? SinceBucketCollectorWrapper
andInternalProfileCollector
implement that interface?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.
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