diff options
Diffstat (limited to 'tests/dialects/test_clickhouse.py')
-rw-r--r-- | tests/dialects/test_clickhouse.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py index af552d1..15adda8 100644 --- a/tests/dialects/test_clickhouse.py +++ b/tests/dialects/test_clickhouse.py @@ -425,6 +425,21 @@ class TestClickhouse(Validator): }, ) + self.validate_identity("ALTER TABLE visits DROP PARTITION 201901") + self.validate_identity("ALTER TABLE visits DROP PARTITION ALL") + self.validate_identity( + "ALTER TABLE visits DROP PARTITION tuple(toYYYYMM(toDate('2019-01-25')))" + ) + self.validate_identity("ALTER TABLE visits DROP PARTITION ID '201901'") + + self.validate_identity("ALTER TABLE visits REPLACE PARTITION 201901 FROM visits_tmp") + self.validate_identity("ALTER TABLE visits REPLACE PARTITION ALL FROM visits_tmp") + self.validate_identity( + "ALTER TABLE visits REPLACE PARTITION tuple(toYYYYMM(toDate('2019-01-25'))) FROM visits_tmp" + ) + 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") + def test_cte(self): self.validate_identity("WITH 'x' AS foo SELECT foo") self.validate_identity("WITH ['c'] AS field_names SELECT field_names") @@ -829,6 +844,9 @@ LIFETIME(MIN 0 MAX 0)""", self.validate_identity( "CREATE TABLE t1 (a String EPHEMERAL, b String EPHEMERAL func(), c String MATERIALIZED func(), d String ALIAS func()) ENGINE=TinyLog()" ) + self.validate_identity( + "CREATE TABLE t (a String, b String, c UInt64, PROJECTION p1 (SELECT a, sum(c) GROUP BY a, b), PROJECTION p2 (SELECT b, sum(c) GROUP BY b)) ENGINE=MergeTree()" + ) def test_agg_functions(self): def extract_agg_func(query): @@ -856,3 +874,8 @@ LIFETIME(MIN 0 MAX 0)""", ) parse_one("foobar(x)").assert_is(exp.Anonymous) + + def test_drop_on_cluster(self): + for creatable in ("DATABASE", "TABLE", "VIEW", "DICTIONARY", "FUNCTION"): + with self.subTest(f"Test DROP {creatable} ON CLUSTER"): + self.validate_identity(f"DROP {creatable} test ON CLUSTER test_cluster") |