[
https://issues.apache.org/jira/browse/CALCITE-7647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095920#comment-18095920
]
Tisya Bhatia commented on CALCITE-7647:
---------------------------------------
[~mbudiu] thanks for the feedback, done
> Support SELECT * in GROUP BY ALL and ORDER BY ALL
> -------------------------------------------------
>
> Key: CALCITE-7647
> URL: https://issues.apache.org/jira/browse/CALCITE-7647
> Project: Calcite
> Issue Type: Improvement
> Reporter: Tisya Bhatia
> Assignee: Tisya Bhatia
> Priority: Major
> Labels: pull-request-available
>
> CALCITE-7594 (GROUP BY ALL) and CALCITE-7597 (ORDER BY ALL) currently reject
> a bare * or qualified t.* in the SELECT list.
> Both bare * and qualified t.* are supported, reusing the same logic real
> SELECT * expansion already uses. A query may reference multiple stars (e.g.
> SELECT {*}, t2.{*}); each is expanded independently and the resulting keys
> are combined, consistent with how Calcite already handles duplicate GROUP BY
> expressions from explicit SQL.
> Other SQL dialects that support {{GROUP BY ALL}} accept a star in the SELECT
> list and expand it to its underlying columns, which then participate in the
> ALL grouping / ordering:
> - DuckDB (which introduced {{{}GROUP BY ALL{}}}): groups by all SELECT
> columns not wrapped in aggregates; {{*}} expands to those columns.
> - Snowflake: all non-aggregate items in the {{SELECT}} list are used for
> grouping.
> - Databricks / Spark SQL: all SELECT-list expressions not containing
> aggregates
> become group expressions.
> This issue makes Calcite consistent with those dialects. The star expands to
> its columns, which become the grouping / sort keys (aggregates are still
> excluded from GROUP BY ALL). Verified against DuckDB:
>
> Testing: SqlValidatorTest cases cover a bare star, a star combined with an
> aggregate and a HAVING clause, NATURAL JOIN, and a comma join across two
> tables.
> Relates to: CALCITE-7594, CALCITE-7597
--
This message was sent by Atlassian Jira
(v8.20.10#820010)