-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Document GROUP BY AUTO syntax #26646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds documentation for the GROUP BY AUTO syntax to the SQL SELECT documentation. The enhancement documents a new feature that automatically determines grouping keys based on non-aggregated columns in the SELECT clause.
- Adds a new "AUTO" section explaining the GROUP BY AUTO syntax
- Includes a practical example with the
shippingtable demonstrating automatic grouping - Shows expected output format for the GROUP BY AUTO query
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
docs/src/main/sphinx/sql/select.md
Outdated
|
|
||
| ### AUTO | ||
|
|
||
| `AUTO` syntax implicitly groups on every column not included in an aggregation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs better phrasing. Maybe something like:
When
AUTOis specified, the Trino engine automatically determines the grouping columns instead of requiring them to be listed explicitly. In this mode, any column in theSELECTlist that is not part of an aggregate function is implicitly treated as a grouping column.
docs/src/main/sphinx/sql/select.md
Outdated
| This query sums the account balance (`acctbal`) for each market segment | ||
| (`mktsegment`), with `AUTO` automatically determining the grouping | ||
| keys: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph describes the query, but does not explain the conclusion that AUTO derives mktsegment as the grouping key since it's not part of any aggregate function. Maybe rephrase to:
This example query calculates the total account balance per market segment. The
AUTOclause derivesmktsegmentas the grouping key, since it is not used in any aggregate function (i.e.,sum).
9e59448 to
cc998ea
Compare
Description
Follow-up of #18390
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.