Tisya Bhatia created CALCITE-7647:
-------------------------------------
Summary: 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
CALCITE-7594 (GROUP BY ALL) and CALCITE-7597 (ORDER BY ALL) currently reject a
bare * or qualified t.* in the SELECT list.
This adds a new private helper in SqlValidatorImpl, expandStarForAllRewrite,
which resolves a star select-item into its underlying column identifiers by
calling the existing private expandStar overload with an isolated,
freshly-constructed selectItems/fields state scoped to that one star item.
rewriteGroupByAll and rewriteOrderByAll call this helper for each star item
encountered while building the grouping/ordering key list, then continue
processing the remaining select-list items exactly as before.
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.
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)