Skip to content

Conversation

bombsimon
Copy link
Contributor

According to the query syntax at
https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list you can combine [ { ALL | DISTINCT } ] with [ AS { STRUCT | VALUE } ]:

SELECT
  [ WITH differential_privacy_clause ]
  [ { ALL | DISTINCT } ]
  [ AS { STRUCT | VALUE } ]
  select_list

This adds support to parse DISTINCT or ALL as the first keyword after SELECT and adds two new variants to the ValueTableMode if defined.

According to the query syntax at
https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list
you can combine `[ { ALL | DISTINCT } ]` with `[ AS { STRUCT | VALUE } ]`:

```sh
SELECT
  [ WITH differential_privacy_clause ]
  [ { ALL | DISTINCT } ]
  [ AS { STRUCT | VALUE } ]
  select_list
```

This adds support to parse `DISTINCT` or `ALL` as the first keyword
after `SELECT` and adds two new variants to the `ValueTableMode` if
defined.
@bombsimon bombsimon force-pushed the distinct-as-struct branch from 6408fc9 to 6a774da Compare June 11, 2025 13:38
This does, similar to regular `ALL`, not store that state on the
`Select` struct so it's not tested as a `verified_stmt`.
@bombsimon bombsimon requested a review from iffyio June 11, 2025 15:34
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @bombsimon!
cc @alamb

@iffyio iffyio merged commit 703ba2c into apache:main Jun 11, 2025
9 checks passed
@iffyio iffyio deleted the distinct-as-struct branch June 11, 2025 16:12
@alamb
Copy link
Contributor

alamb commented Jun 12, 2025

woohoo

solontsev pushed a commit to solontsev/datafusion-sqlparser-rs that referenced this pull request Jun 20, 2025
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.

3 participants