Class PushStatsToExternalSource
Supports both SINGLE and INITIAL modes. In SINGLE mode the replacement produces final-value
blocks (one block per aggregate). In INITIAL mode the replacement produces intermediate-format
blocks matching AggregateExec.intermediateAttributes(): for each aggregate, a typed
value block followed by a seen boolean block.
Handles intermediate EvalExec (from EVAL), ProjectExec (from RENAME), and FilterExec nodes between the aggregate and external source by resolving aliased attribute names back to the original column names before metadata lookup, and by classifying filters against per-split statistics when present.
Supports multi-split queries when per-split statistics are available in
FileSplit.splitStats().
Statistics are merged across splits (sum row counts, min-of-mins, max-of-maxes).
Falls back to normal execution when any split lacks stats.
Substitution from metadata statistics is skipped when ExternalSourceExec carries
ExternalSourceExec.pushedExpressions() or ExternalSourceExec.pushedFilter():
those predicates narrow the scanned rows; footer split stats do not reflect them after
PushFiltersToSource removes the enclosing FilterExec.
Note: MIN/MAX pushdown uses values from file metadata. Temporal columns (DATE/TIMESTAMP/INT96)
are decoded to ESQL's epoch-millisecond representation at stat-publication time by the format
reader (see ParquetColumnDecoding#decodeTemporalStat), so the pushed values already match
the scan path.
-
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
-
PushStatsToExternalSource
public PushStatsToExternalSource()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
-