Class PushStatsToExternalSource
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<AggregateExec,PhysicalPlan>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.OptimizerRule<AggregateExec>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.PushStatsToExternalSource
Pushes ungrouped aggregate functions (COUNT, MIN, MAX) to external sources when the
required statistics are available in the file metadata. Replaces the AggregateExec +
ExternalSourceExec subtree with a LocalSourceExec containing pre-computed results.
Handles intermediate EvalExec (from EVAL) and ProjectExec (from RENAME) nodes between the aggregate and external source by resolving aliased attribute names back to the original column names before metadata lookup.
Supports multi-split queries when per-split statistics are available in
FileSplit.statistics(). Statistics are merged across splits (sum row counts,
min-of-mins, max-of-maxes). Falls back to normal execution when any split lacks stats.
Note: MIN/MAX pushdown uses raw values from file metadata. For DATE/TIMESTAMP columns, the raw values may not match ESQL's millisecond representation. A future enhancement should convert these values using the column's data type.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.OptimizerRule
apply
-
Constructor Details
-
PushStatsToExternalSource
public PushStatsToExternalSource()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.OptimizerRule<AggregateExec>
-