Skip to content

[CALCITE-7647] Support SELECT * in GROUP BY ALL and ORDER BY ALL#5089

Open
tisyabhatia wants to merge 1 commit into
apache:mainfrom
tisyabhatia:group-by-order-by-all-select-star
Open

[CALCITE-7647] Support SELECT * in GROUP BY ALL and ORDER BY ALL#5089
tisyabhatia wants to merge 1 commit into
apache:mainfrom
tisyabhatia:group-by-order-by-all-select-star

Conversation

@tisyabhatia

@tisyabhatia tisyabhatia commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Jira Link

CALCITE-7647

Changes Proposed

Expand a bare or qualified star in the SELECT clause to its underlying columns when rewriting GROUP BY ALL / ORDER BY ALL, so those clauses no longer reject SELECT *. Star items are expanded via the existing column-enumeration path (matching normal SELECT * semantics), before the placeholder is replaced with the concrete keys.

Expand a bare or qualified star in the SELECT clause to its underlying columns when rewriting GROUP BY ALL / ORDER BY ALL, so those clauses no longer reject SELECT *. Star items are expanded via the existing column-enumeration path (matching normal SELECT * semantics, including NATURAL JOIN coalescing), before the placeholder is replaced with the concrete keys.
* memoized grouping set with the not-yet-rewritten placeholder. The fresh
* {@code items}/{@code fields} must stay paired for NATURAL/USING index
* alignment. */
private List<SqlNode> expandStarForAllRewrite(SqlSelect select, SqlNode starItem) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how does this differ from expand star?
Can this be avoided by doing the rewriteOrderByAll after the star expansion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

expandStarForAllRewrite just runs the normal star expansion on the *. I don't call the public expandStar because it expands the whole SELECT list before GROUP BY ALL is replaced and that makes the real columns look "not grouped."

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants