Skip to content

Allow bare columns in GROUPING SETS expressions#2288

Open
funcpp wants to merge 1 commit intoapache:mainfrom
funcpp:fix-grouping-sets-bare-columns
Open

Allow bare columns in GROUPING SETS expressions#2288
funcpp wants to merge 1 commit intoapache:mainfrom
funcpp:fix-grouping-sets-bare-columns

Conversation

@funcpp
Copy link
Copy Markdown
Contributor

@funcpp funcpp commented Mar 31, 2026

Summary

  • Change parse_tuple(false, true) to parse_tuple(true, true) for GROUPING SETS in parse_group_by_expr, matching CUBE and ROLLUP

GROUPING SETS required each element to be parenthesized, while CUBE and ROLLUP already accepted bare columns. This meant valid syntax like GROUPING SETS (a, b, c) failed to parse. The PostgreSQL grammar explicitly allows expression as a grouping element.

The modifier path (added in #1653) already uses parse_tuple(true, true) for GROUPING SETS — this PR fixes the expression path to be consistent.

Test plan

  • New test: bare columns and mixed bare/parenthesized elements
  • Existing GROUPING SETS tests unaffected
  • Full test suite passes

GROUPING SETS used parse_tuple(false, true) which required each
element to be parenthesized, while CUBE and ROLLUP already used
parse_tuple(true, true) allowing bare columns. This inconsistency
meant GROUPING SETS (a, b, c) failed to parse despite being valid
syntax in PostgreSQL, Databricks, and other dialects.
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.

1 participant