Skip to content

Commit c842f14

Browse files
committed
Add shard context information to aggregate filters
1 parent 425f146 commit c842f14

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public final PhysicalOperation groupingPhysicalOperation(
9797
aggregatorMode,
9898
sourceLayout,
9999
false, // non-grouping
100-
s -> aggregatorFactories.add(s.supplier.aggregatorFactory(s.mode, s.channels))
100+
s -> aggregatorFactories.add(s.supplier.aggregatorFactory(s.mode, s.channels)),
101+
context
101102
);
102103

103104
if (aggregatorFactories.isEmpty() == false) {
@@ -171,7 +172,8 @@ else if (aggregatorMode.isOutputPartial()) {
171172
aggregatorMode,
172173
sourceLayout,
173174
true, // grouping
174-
s -> aggregatorFactories.add(s.supplier.groupingAggregatorFactory(s.mode, s.channels))
175+
s -> aggregatorFactories.add(s.supplier.groupingAggregatorFactory(s.mode, s.channels)),
176+
context
175177
);
176178
// time-series aggregation
177179
if (Expressions.anyMatch(aggregates, a -> a instanceof ToTimeSeriesAggregator)
@@ -273,7 +275,8 @@ private void aggregatesToFactory(
273275
AggregatorMode mode,
274276
Layout layout,
275277
boolean grouping,
276-
Consumer<AggFunctionSupplierContext> consumer
278+
Consumer<AggFunctionSupplierContext> consumer,
279+
LocalExecutionPlannerContext context
277280
) {
278281
// extract filtering channels - and wrap the aggregation with the new evaluator expression only during the init phase
279282
for (NamedExpression ne : aggregates) {
@@ -333,7 +336,8 @@ else if (mode == AggregatorMode.FINAL || mode == AggregatorMode.INTERMEDIATE) {
333336
EvalOperator.ExpressionEvaluator.Factory evalFactory = EvalMapper.toEvaluator(
334337
foldContext,
335338
aggregateFunction.filter(),
336-
layout
339+
layout,
340+
context.shardContexts()
337341
);
338342
aggSupplier = new FilteredAggregatorFunctionSupplier(aggSupplier, evalFactory);
339343
}

0 commit comments

Comments
 (0)