summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_clickhouse.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-23 11:12:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-23 11:12:26 +0000
commit6ea73443a6a81d2477f8eab80dcf1a9206a44d5e (patch)
treeb44112413472fb48b734e74cc01ac1082c197c4c /tests/dialects/test_clickhouse.py
parentAdding upstream version 25.5.1. (diff)
downloadsqlglot-6ea73443a6a81d2477f8eab80dcf1a9206a44d5e.tar.xz
sqlglot-6ea73443a6a81d2477f8eab80dcf1a9206a44d5e.zip
Adding upstream version 25.6.1.upstream/25.6.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_clickhouse.py')
-rw-r--r--tests/dialects/test_clickhouse.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py
index ef84d48..8f8c7f0 100644
--- a/tests/dialects/test_clickhouse.py
+++ b/tests/dialects/test_clickhouse.py
@@ -84,6 +84,9 @@ class TestClickhouse(Validator):
self.validate_identity("TRUNCATE DATABASE db")
self.validate_identity("TRUNCATE DATABASE db ON CLUSTER test_cluster")
self.validate_identity(
+ "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"
+ )
+ self.validate_identity(
"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"
)
self.validate_identity(
@@ -448,6 +451,10 @@ class TestClickhouse(Validator):
self.validate_identity("ALTER TABLE visits REPLACE PARTITION ID '201901' FROM visits_tmp")
self.validate_identity("ALTER TABLE visits ON CLUSTER test_cluster DROP COLUMN col1")
+ self.assertIsInstance(
+ parse_one("Tuple(select Int64)", into=exp.DataType, read="clickhouse"), exp.DataType
+ )
+
def test_cte(self):
self.validate_identity("WITH 'x' AS foo SELECT foo")
self.validate_identity("WITH ['c'] AS field_names SELECT field_names")
@@ -545,6 +552,7 @@ class TestClickhouse(Validator):
self.validate_identity(
"CREATE TABLE foo (x UInt32) TTL time_column + INTERVAL '1' MONTH DELETE WHERE column = 'value'"
)
+ self.validate_identity("CREATE TABLE named_tuples (a Tuple(select String, i Int64))")
self.validate_all(
"""