You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/dialects/test_clickhouse.py
+3
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,9 @@ def test_clickhouse(self):
83
83
self.validate_identity("TRUNCATE TABLE t1 ON CLUSTER test_cluster")
84
84
self.validate_identity("TRUNCATE DATABASE db")
85
85
self.validate_identity("TRUNCATE DATABASE db ON CLUSTER test_cluster")
86
+
self.validate_identity(
87
+
"SELECT number, COUNT() OVER (PARTITION BY number % 3) AS partition_count FROM numbers(10) WINDOW window_name AS (PARTITION BY number) QUALIFY partition_count = 4 ORDER BY number"
88
+
)
86
89
self.validate_identity(
87
90
"SELECT id, quantileGK(100, 0.95)(reading) OVER (PARTITION BY id ORDER BY id RANGE BETWEEN 30000 PRECEDING AND CURRENT ROW) AS window FROM table"
Copy file name to clipboardExpand all lines: tests/dialects/test_dialect.py
+2-2
Original file line number
Diff line number
Diff line change
@@ -2267,7 +2267,7 @@ def test_qualify(self):
2267
2267
write={
2268
2268
"duckdb": "SELECT * FROM t QUALIFY COUNT(*) OVER () > 1",
2269
2269
"snowflake": "SELECT * FROM t QUALIFY COUNT(*) OVER () > 1",
2270
-
"clickhouse": "SELECT * FROM (SELECT *, COUNT(*) OVER () AS _w FROM t) AS _t WHERE _w > 1",
2270
+
"clickhouse": "SELECT * FROM t QUALIFY COUNT(*) OVER () > 1",
2271
2271
"mysql": "SELECT * FROM (SELECT *, COUNT(*) OVER () AS _w FROM t) AS _t WHERE _w > 1",
2272
2272
"oracle": "SELECT * FROM (SELECT *, COUNT(*) OVER () AS _w FROM t) _t WHERE _w > 1",
2273
2273
"postgres": "SELECT * FROM (SELECT *, COUNT(*) OVER () AS _w FROM t) AS _t WHERE _w > 1",
@@ -2279,7 +2279,7 @@ def test_qualify(self):
2279
2279
write={
2280
2280
"duckdb": 'SELECT "user id", some_id, 1 AS other_id, 2 AS "2 nd id" FROM t QUALIFY COUNT(*) OVER () > 1',
2281
2281
"snowflake": 'SELECT "user id", some_id, 1 AS other_id, 2 AS "2 nd id" FROM t QUALIFY COUNT(*) OVER () > 1',
2282
-
"clickhouse": 'SELECT "user id", some_id, other_id, "2 nd id" FROM (SELECT "user id", some_id, 1 AS other_id, 2 AS "2 nd id", COUNT(*) OVER () AS _w FROM t) AS _t WHERE _w > 1',
2282
+
"clickhouse": 'SELECT "user id", some_id, 1 AS other_id, 2 AS "2 nd id" FROM t QUALIFY COUNT(*) OVER () > 1',
2283
2283
"mysql": "SELECT `user id`, some_id, other_id, `2 nd id` FROM (SELECT `user id`, some_id, 1 AS other_id, 2 AS `2 nd id`, COUNT(*) OVER () AS _w FROM t) AS _t WHERE _w > 1",
2284
2284
"oracle": 'SELECT "user id", some_id, other_id, "2 nd id" FROM (SELECT "user id", some_id, 1 AS other_id, 2 AS "2 nd id", COUNT(*) OVER () AS _w FROM t) _t WHERE _w > 1',
2285
2285
"postgres": 'SELECT "user id", some_id, other_id, "2 nd id" FROM (SELECT "user id", some_id, 1 AS other_id, 2 AS "2 nd id", COUNT(*) OVER () AS _w FROM t) AS _t WHERE _w > 1',
Copy file name to clipboardExpand all lines: tests/dialects/test_duckdb.py
+4
Original file line number
Diff line number
Diff line change
@@ -361,6 +361,10 @@ def test_duckdb(self):
361
361
self.validate_identity(
362
362
"SELECT * FROM (PIVOT Cities ON Year USING SUM(Population) GROUP BY Country) AS pivot_alias"
363
363
)
364
+
self.validate_identity(
365
+
# QUALIFY comes after WINDOW
366
+
"SELECT schema_name, function_name, ROW_NUMBER() OVER my_window AS function_rank FROM DUCKDB_FUNCTIONS() WINDOW my_window AS (PARTITION BY schema_name ORDER BY function_name) QUALIFY ROW_NUMBER() OVER my_window < 3"
0 commit comments