Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Feb 9, 2026

Which issue does this PR close?

This is an alternatative to

Rationale for this change

Wrong answers bug was exposed by #19287 in 52. See #20244 and backstory here

What changes are included in this PR?

Fix the bug by properly implemnting

Are these changes tested?

Yes, a new test is added

Are there any user-facing changes?

A bug is fixed

@github-actions github-actions bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Feb 9, 2026
@alamb alamb changed the title Fix group by sorting bug (option 2) Fix incorrect SortExec removal before AggregateExec (option 2) Feb 10, 2026
}
}
} else if let Some(aggregate_exec) = plan.as_any().downcast_ref::<AggregateExec>() {
handle_aggregate_pushdown(aggregate_exec, parent_required)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment explains why this is needed: #19287 (comment)

Basically the generic version is not correct for AggregateExec, but this was masked due to some limitations that were lifted in #19287

@alamb alamb marked this pull request as ready for review February 10, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect answers due to an incorrectly removed Sort before AggregateExec

1 participant