Skip to content

Remove unused parameter from SiblingPipelineAggregator.doReduce #126365

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -578,15 +578,11 @@ public int count() {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
if (aggregationBuilders != null) {
for (AggregationBuilder subAgg : aggregationBuilders) {
subAgg.toXContent(builder, params);
}
for (AggregationBuilder subAgg : aggregationBuilders) {
subAgg.toXContent(builder, params);
}
if (pipelineAggregatorBuilders != null) {
for (PipelineAggregationBuilder subAgg : pipelineAggregatorBuilders) {
subAgg.toXContent(builder, params);
}
for (PipelineAggregationBuilder subAgg : pipelineAggregatorBuilders) {
subAgg.toXContent(builder, params);
}
builder.endObject();
return builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private static InternalAggregations maybeExecuteFinalReduce(AggregationReduceCon

for (PipelineAggregator pipelineAggregator : context.pipelineTreeRoot().aggregators()) {
SiblingPipelineAggregator sib = (SiblingPipelineAggregator) pipelineAggregator;
InternalAggregation newAgg = sib.doReduce(from(reducedInternalAggs), context);
InternalAggregation newAgg = sib.doReduce(from(reducedInternalAggs));
reducedInternalAggs.add(newAgg);
}
return from(reducedInternalAggs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationExecutionException;
import org.elasticsearch.search.aggregations.AggregationReduceContext;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
Expand Down Expand Up @@ -47,7 +46,7 @@ public abstract class BucketMetricsPipelineAggregator extends SiblingPipelineAgg
}

@Override
public final InternalAggregation doReduce(InternalAggregations aggregations, AggregationReduceContext context) {
public final InternalAggregation doReduce(InternalAggregations aggregations) {
preCollection();
List<AggregationPath.PathElement> parsedPath = AggregationPath.parse(bucketsPaths()[0]).getPathElements();
for (Aggregation aggregation : aggregations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ protected SiblingPipelineAggregator(String name, String[] bucketsPaths, Map<Stri
public InternalAggregation reduce(InternalAggregation aggregation, AggregationReduceContext reduceContext) {
return aggregation.copyWithRewritenBuckets(
aggregations -> InternalAggregations.from(
CollectionUtils.appendToCopyNoNullElements(aggregations.copyResults(), doReduce(aggregations, reduceContext))
CollectionUtils.appendToCopyNoNullElements(aggregations.copyResults(), doReduce(aggregations))
)
);
}

public abstract InternalAggregation doReduce(InternalAggregations aggregations, AggregationReduceContext context);
public abstract InternalAggregation doReduce(InternalAggregations aggregations);
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void testSameAggNames() throws IOException {
reducedAggs.add(histogramResult);
reducedAggs.add(avgResult);
InternalAggregations aggregations = InternalAggregations.from(reducedAggs);
InternalAggregation pipelineResult = ((AvgBucketPipelineAggregator) avgBucketAgg).doReduce(aggregations, null);
InternalAggregation pipelineResult = ((AvgBucketPipelineAggregator) avgBucketAgg).doReduce(aggregations);
assertNotNull(pipelineResult);
}
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public void testComplicatedBucketPath() throws IOException {

reducedAggs.add(filterResult);
InternalAggregations aggregations = InternalAggregations.from(reducedAggs);
InternalAggregation pipelineResult = ((AvgBucketPipelineAggregator) avgBucketAgg).doReduce(aggregations, null);
InternalAggregation pipelineResult = ((AvgBucketPipelineAggregator) avgBucketAgg).doReduce(aggregations);
assertNotNull(pipelineResult);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package org.elasticsearch.xpack.ml.aggs.changepoint;

import org.elasticsearch.search.aggregations.AggregationReduceContext;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers;
Expand All @@ -27,7 +26,7 @@ public ChangePointAggregator(String name, String bucketsPath, Map<String, Object
}

@Override
public InternalAggregation doReduce(InternalAggregations aggregations, AggregationReduceContext context) {
public InternalAggregation doReduce(InternalAggregations aggregations) {
Optional<MlAggsHelper.DoubleBucketValues> maybeBucketValues = extractDoubleBucketedValues(
bucketsPaths()[0],
aggregations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.elasticsearch.xpack.ml.aggs.correlation;

import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.AggregationReduceContext;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.InternalSimpleValue;
Expand All @@ -33,7 +32,7 @@ public BucketCorrelationAggregator(
}

@Override
public InternalAggregation doReduce(InternalAggregations aggregations, AggregationReduceContext context) {
public InternalAggregation doReduce(InternalAggregations aggregations) {
CountCorrelationIndicator bucketPathValue = MlAggsHelper.extractDoubleBucketedValues(bucketsPaths()[0], aggregations)
.map(
doubleBucketValues -> new CountCorrelationIndicator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.search.aggregations.AggregationExecutionException;
import org.elasticsearch.search.aggregations.AggregationReduceContext;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.SiblingPipelineAggregator;
Expand Down Expand Up @@ -224,7 +223,7 @@ private static double sidedKSStat(double a, double b, Alternative alternative) {
}

@Override
public InternalAggregation doReduce(InternalAggregations aggregations, AggregationReduceContext context) {
public InternalAggregation doReduce(InternalAggregations aggregations) {
Optional<MlAggsHelper.DoubleBucketValues> maybeBucketsValue = extractDoubleBucketedValues(bucketsPaths()[0], aggregations).map(
bucketValue -> {
double[] values = new double[bucketValue.getValues().length + 1];
Expand Down