Skip to content

Conversation

@ebyhr
Copy link
Member

@ebyhr ebyhr commented Sep 16, 2025

Description

Follow-up of #18390

Screenshot 2025-10-04 at 5 38 55

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.

@cla-bot cla-bot bot added the cla-signed label Sep 16, 2025
@ebyhr ebyhr marked this pull request as ready for review September 16, 2025 20:01
@github-actions github-actions bot added the docs label Sep 16, 2025
@wendigo wendigo requested a review from Copilot September 16, 2025 20:21
Copy link

Copilot AI left a 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 shipping table 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.

@martint martint requested a review from mosabua October 3, 2025 16:59

### AUTO

`AUTO` syntax implicitly groups on every column not included in an aggregation
Copy link
Member

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 AUTO is specified, the Trino engine automatically determines the grouping columns instead of requiring them to be listed explicitly. In this mode, any column in the SELECT list that is not part of an aggregate function is implicitly treated as a grouping column.

Comment on lines 387 to 389
This query sums the account balance (`acctbal`) for each market segment
(`mktsegment`), with `AUTO` automatically determining the grouping
keys:
Copy link
Member

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 AUTO clause derives mktsegment as the grouping key, since it is not used in any aggregate function (i.e., sum).

@ebyhr ebyhr force-pushed the ebi/doc-group-by-auto branch from 9e59448 to cc998ea Compare October 3, 2025 20:38
@ebyhr ebyhr merged commit 5c4cb0e into trinodb:master Oct 3, 2025
9 checks passed
@ebyhr ebyhr deleted the ebi/doc-group-by-auto branch October 3, 2025 21:19
@github-actions github-actions bot added this to the 478 milestone Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants