Class PushAggregatesToExternalSource


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.