Skip to content

fix(e6): transpile COLLECT_SET to ARRAY_AGG(DISTINCT ...) - #331

Merged
tkaunlaky-e6 merged 2 commits into
mainfrom
fix/e6-collect-set-distinct
Oct 26, 2026
Merged

tkaunlaky-e6 merged 2 commits into
mainfrom
fix/e6-collect-set-distinct

Conversation

@tkaunlaky-e6

Copy link
Copy Markdown

Problem

Databricks COLLECT_SET(col) was transpiled to ARRAY_AGG(col), so e6 returned duplicate values instead of a set (e.g. ['1','1','2','2','3'] instead of ['1','2','3']).

Fix

COLLECT_SET parses to exp.ArrayUniqueAgg. The E6 generator used rename_func("ARRAY_AGG"), which drops the distinct semantics. It now emits ARRAY_AGG(DISTINCT ...), matching the existing Trino generator (sqlglot/dialects/trino.py).

Tests

  • Corrected the existing collect_set test, which asserted the buggy output.
  • Added the reported query as a test.
  • tests/dialects/test_e6.py: all passing.

ArrayUniqueAgg was renamed to plain ARRAY_AGG, dropping the distinct
semantics, so Databricks collect_set returned duplicate values on e6.
DuckDB 2.0 rejects the deprecated '->' lambda syntax that the duckdb
generator emits, breaking test_optimized_tpch (TPC-H 21) in CI.
@tkaunlaky-e6
tkaunlaky-e6 merged commit 3dc5bfa into main Oct 26, 2026
6 checks passed
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.

2 participants