Skip to content

fix: Resolve ORDER BY aggregate expressions when HAVING is present#219

Merged
MazterQyou merged 1 commit into
cubesql-3-04-2022from
cubesql/resolve-order-by-with-having
Jul 15, 2026
Merged

fix: Resolve ORDER BY aggregate expressions when HAVING is present#219
MazterQyou merged 1 commit into
cubesql-3-04-2022from
cubesql/resolve-order-by-with-having

Conversation

@MazterQyou

Copy link
Copy Markdown
Member

This PR fixes ORDER BY on an aggregate expression not being resolved to the aggregate output column when the query also has a HAVING clause: rewrite_sort_col_by_aggs stopped at the Filter that HAVING plans between the final Projection and the Aggregate, leaving a raw aggregate call in the Sort node. Related test is included.

Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
@MazterQyou
MazterQyou merged commit 1c073df into cubesql-3-04-2022 Jul 15, 2026
21 checks passed
@MazterQyou
MazterQyou deleted the cubesql/resolve-order-by-with-having branch July 15, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant