From 61562f64b92869046e14482365339428fef67b9a Mon Sep 17 00:00:00 2001 From: Ignacio Vera Date: Tue, 19 Sep 2023 12:52:25 +0200 Subject: [PATCH] Remove supportsParallelCollection implementation for some aggs (#99654) enable Cardinality, composite, nested and Frequent imters aggregations for concurrent execution. --- .../bucket/composite/CompositeAggregationBuilder.java | 5 ----- .../histogram/VariableWidthHistogramAggregationBuilder.java | 5 ----- .../bucket/nested/NestedAggregationBuilder.java | 5 ----- .../aggregations/metrics/CardinalityAggregationBuilder.java | 5 ----- .../search/aggregations/AggregatorFactoriesTests.java | 6 +++--- .../FrequentItemSetsAggregationBuilder.java | 5 ----- 6 files changed, 3 insertions(+), 28 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregationBuilder.java index 6b894b3a9dbbd..ca88d50898763 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregationBuilder.java @@ -97,11 +97,6 @@ public boolean supportsSampling() { return true; } - @Override - public boolean supportsParallelCollection() { - return false; - } - public CompositeAggregationBuilder(StreamInput in) throws IOException { super(in); int num = in.readVInt(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregationBuilder.java index 9ca606f460fbb..f7870df45648e 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregationBuilder.java @@ -137,11 +137,6 @@ public BucketCardinality bucketCardinality() { return BucketCardinality.MANY; } - @Override - public boolean supportsParallelCollection() { - return false; - } - @Override protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map metaData) { return new VariableWidthHistogramAggregationBuilder(this, factoriesBuilder, metaData); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java index b6e6a39356d46..f4ba3db383586 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java @@ -81,11 +81,6 @@ public BucketCardinality bucketCardinality() { return BucketCardinality.ONE; } - @Override - public boolean supportsParallelCollection() { - return false; - } - @Override protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java index 03e3dc93675d3..615b46434226d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java @@ -113,11 +113,6 @@ public boolean supportsSampling() { return true; } - @Override - public boolean supportsParallelCollection() { - return false; - } - @Override protected boolean serializeTargetValueType(TransportVersion version) { return true; diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java index bf0b087f67a5a..d67e99e4521f1 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java @@ -334,19 +334,19 @@ public void testSupportsParallelCollection() { { AggregatorFactories.Builder builder = new AggregatorFactories.Builder(); builder.addAggregator(new CardinalityAggregationBuilder("cardinality")); - assertFalse(builder.supportsParallelCollection()); + assertTrue(builder.supportsParallelCollection()); } { AggregatorFactories.Builder builder = new AggregatorFactories.Builder(); builder.addAggregator(new NestedAggregationBuilder("nested", "path")); - assertFalse(builder.supportsParallelCollection()); + assertTrue(builder.supportsParallelCollection()); } { AggregatorFactories.Builder builder = new AggregatorFactories.Builder(); builder.addAggregator( new CompositeAggregationBuilder("composite", Collections.singletonList(new TermsValuesSourceBuilder("name"))) ); - assertFalse(builder.supportsParallelCollection()); + assertTrue(builder.supportsParallelCollection()); } { AggregatorFactories.Builder builder = new AggregatorFactories.Builder(); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetsAggregationBuilder.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetsAggregationBuilder.java index 9081f4118f89f..684d61dbdedb3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetsAggregationBuilder.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetsAggregationBuilder.java @@ -182,11 +182,6 @@ public boolean supportsSampling() { return true; } - @Override - public boolean supportsParallelCollection() { - return false; - } - @Override protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metadata) { return new FrequentItemSetsAggregationBuilder(name, fields, minimumSupport, minimumSetSize, size, filter, executionHint);