diff --git a/setup.py b/setup.py index 3d3f514039..c6445f42de 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ def sqlglotrs_version(): setup( extras_require={ "dev": [ - "duckdb>=0.6", + "duckdb>=0.6,<2", "mypy==1.14.1", "pandas", "pandas-stubs", diff --git a/sqlglot/dialects/e6.py b/sqlglot/dialects/e6.py index 1114cffe28..de322db279 100644 --- a/sqlglot/dialects/e6.py +++ b/sqlglot/dialects/e6.py @@ -3657,7 +3657,7 @@ def create_lpad_component(func_name: str): if e.args.get("is_index") else e.args.get("length") + e.args.get("from_index"), ), - exp.ArrayUniqueAgg: rename_func("ARRAY_AGG"), + exp.ArrayUniqueAgg: lambda self, e: f"ARRAY_AGG(DISTINCT {self.sql(e, 'this')})", exp.ArrayPosition: lambda self, e: self.func("ARRAY_POSITION", e.expression, e.this), exp.SafeDivide: rename_func("TRY_DIVIDE"), exp.SortArray: rename_func("ARRAY_SORT"), diff --git a/tests/dialects/test_e6.py b/tests/dialects/test_e6.py index bad9bfa511..56586f0744 100644 --- a/tests/dialects/test_e6.py +++ b/tests/dialects/test_e6.py @@ -3075,12 +3075,19 @@ def test_array_agg(self): ) self.validate_all( - "SELECT ARRAY_AGG(col) FROM (VALUES (1), (2), (NULL), (1)) AS tab(col)", + "SELECT ARRAY_AGG(DISTINCT col) FROM (VALUES (1), (2), (NULL), (1)) AS tab(col)", read={ "databricks": "SELECT collect_set(col) FROM VALUES (1), (2), (NULL), (1) AS tab(col)", }, ) + self.validate_all( + "SELECT ARRAY_AGG(DISTINCT col1) FROM (SELECT '1' AS col1 UNION ALL SELECT '1' AS col1 UNION ALL SELECT '2' AS col1 UNION ALL SELECT '2' AS col1 UNION ALL SELECT '3' AS col1)", + read={ + "databricks": 'select collect_set(col1) from (select "1" as col1 union all select "1" as col1 union all select "2" as col1 union all select "2" as col1 union all select "3" as col1)', + }, + ) + def test_bitwise(self): self.validate_all( "BITWISE_NOT(1)",