Skip to content

Commit 8b0918b

Browse files
committed
Simplify agg construction when reducing node-level
1 parent 6f27ac8 commit 8b0918b

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/AbstractPhysicalOperationProviders.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ public final PhysicalOperation groupingPhysicalOperation(
7171

7272
var sourceLayout = source.layout;
7373

74-
if (aggregatorMode != AggregatorMode.INITIAL && aggregatorMode != AggregatorMode.FINAL) {
75-
assert false : "Invalid aggregator mode [" + aggregatorMode + "]";
76-
}
77-
if (aggregatorMode == AggregatorMode.INITIAL && aggregateExec.child() instanceof ExchangeSourceExec) {
78-
// the reducer step at data node (local) level
79-
aggregatorMode = AggregatorMode.INTERMEDIATE;
80-
}
81-
8274
if (aggregateExec.groupings().isEmpty()) {
8375
// not grouping
8476
List<Aggregator.Factory> aggregatorFactories = new ArrayList<>();

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/PlannerUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static PhysicalPlan reductionPlan(PhysicalPlan plan) {
124124
final LocalMapper mapper = new LocalMapper();
125125
PhysicalPlan reducePlan = mapper.map(pipelineBreaker);
126126
if (reducePlan instanceof AggregateExec agg) {
127-
reducePlan = agg.withMode(AggregatorMode.INITIAL); // force to emit intermediate outputs
127+
reducePlan = agg.withMode(AggregatorMode.INTERMEDIATE);
128128
}
129129
return EstimatesRowSize.estimateRowSize(fragment.estimatedRowSize(), reducePlan);
130130
}

0 commit comments

Comments
 (0)