Document GROUP BY AUTO syntax#26646
Conversation
There was a problem hiding this comment.
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.
|
|
||
| ### AUTO | ||
|
|
||
| `AUTO` syntax implicitly groups on every column not included in an aggregation |
There was a problem hiding this comment.
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.
| 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.
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.