Skip to content

fix(bigquery): correct percentile and distinct-array transpilation - #8674

Merged
georgesittas merged 3 commits into
mainfrom
fix/bigquery-aggregate-semantics
Oct 19, 2026
Merged

georgesittas merged 3 commits into
mainfrom
fix/bigquery-aggregate-semantics

Conversation

@georgesittas

Copy link
Copy Markdown
Collaborator

Follow-up to d17c768.

  • Parse Trino’s three-argument APPROX_PERCENTILE as (value, weight, percentile), preserving Presto’s accuracy overload.
  • Preserve DuckDB’s NULL-removal behavior when folding ARRAY_DISTINCT into ARRAY_AGG, including all-NULL and empty inputs.
  • Report windowed percentile conversion as unsupported instead of generating invalid BigQuery SQL.

Verified with runsql against Trino, Presto, DuckDB, and BigQuery.

@georgesittas
georgesittas requested review from tobymao and a balanced review from Copilot October 19, 2026 09:48

This comment was marked as resolved.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

SQLGlot Integration Test Results

✅ All tests passed

Comparing:

  • this branch (sqlglot:fix/bigquery-aggregate-semantics @ sqlglot 6baff07)
  • baseline (main @ sqlglot 9beb4ab)

Overall

main: 182931 total, 166014 passed (pass rate: 90.8%)

sqlglot:fix/bigquery-aggregate-semantics: 178869 total, 162709 passed (pass rate: 91.0%)

Transitions:
No change

Dialect pair changes: 0 previous results not found, 1 current results not found

✅ All tests passed

This comment was marked as resolved.

This comment was marked as resolved.

@georgesittas
georgesittas merged commit f536a82 into main Oct 19, 2026
10 checks passed
@georgesittas
georgesittas deleted the fix/bigquery-aggregate-semantics branch October 19, 2026 12:07
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