Skip to content

Commit cba2558

Browse files
wip
1 parent 3cd1ba5 commit cba2558

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

  • datafusion/physical-plan/src/aggregates

datafusion/physical-plan/src/aggregates/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,11 +1473,9 @@ impl ExecutionPlan for AggregateExec {
14731473
// This optimization is NOT safe for filters on aggregated columns (like filtering on
14741474
// the result of SUM or COUNT), as those require computing all groups first.
14751475

1476-
// Build grouping columns using OUTPUT indices, not input indices.
1477-
// Parent filters reference the AggregateExec's output schema where grouping
1478-
// columns occupy positions [0..num_groups). The grouping expressions reference
1479-
// INPUT columns which may have different indices (e.g., when an intermediate
1480-
// ProjectionExec reorders columns). We must compare in the same index space.
1476+
// Build grouping columns using output indices because parent filters reference the AggregateExec's output schema where grouping
1477+
// columns in the output schema. The grouping expressions reference
1478+
// input columns which may not match the output schema.
14811479
let output_schema = self.schema();
14821480
let grouping_columns: HashSet<_> = (0..self.group_by.expr().len())
14831481
.map(|i| Column::new(output_schema.field(i).name(), i))

0 commit comments

Comments
 (0)