Class PushAggregatesToExternalSource
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<AggregateExec,PhysicalPlan>
org.elasticsearch.xpack.esql.rule.ParameterizedRule<AggregateExec,PhysicalPlan,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.PushAggregatesToExternalSource
public class PushAggregatesToExternalSource
extends PhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
Replaces
AggregateExec → ExternalSourceExec with LocalSourceExec
when ungrouped aggregates (COUNT(*), MIN, MAX) can be computed from file-level statistics.
Works in both SINGLE mode (coordinator-only) and INITIAL mode (data node in distributed execution). The coordinator's FINAL AggregateExec is never touched — it merges intermediate values from all data nodes regardless of whether each data node pushed down or scanned.
Statistics come from ExternalSourceExec.sourceMetadata() for single-split queries, or
from merged per-split statistics in FileSplit.statistics() for multi-split queries.
Falls back to normal execution when any split lacks statistics.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PhysicalPlanrule(AggregateExec aggregateExec, LocalPhysicalOptimizerContext ctx) Methods inherited from class org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule
applyMethods inherited from class org.elasticsearch.xpack.esql.rule.ParameterizedRule
apply
-
Constructor Details
-
PushAggregatesToExternalSource
public PushAggregatesToExternalSource()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
-