From c03ba18c491e52cc85d8aae1825dd9e0b4f75e32 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 26 Oct 2023 19:21:54 +0200 Subject: Merging upstream version 18.17.0. Signed-off-by: Daniel Baumann --- tests/dialects/test_clickhouse.py | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'tests/dialects/test_clickhouse.py') diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py index 948c00e..93d1ced 100644 --- a/tests/dialects/test_clickhouse.py +++ b/tests/dialects/test_clickhouse.py @@ -6,6 +6,22 @@ class TestClickhouse(Validator): dialect = "clickhouse" def test_clickhouse(self): + self.validate_identity("x <> y") + + self.validate_all( + "has([1], x)", + read={ + "postgres": "x = any(array[1])", + }, + ) + self.validate_all( + "NOT has([1], x)", + read={ + "postgres": "any(array[1]) <> x", + }, + ) + self.validate_identity("x = y") + string_types = [ "BLOB", "LONGBLOB", @@ -85,6 +101,39 @@ class TestClickhouse(Validator): "CREATE MATERIALIZED VIEW test_view (id UInt8) TO db.table1 AS SELECT * FROM test_data" ) + self.validate_all( + "SELECT CAST('2020-01-01' AS TIMESTAMP) + INTERVAL '500' microsecond", + read={ + "duckdb": "SELECT TIMESTAMP '2020-01-01' + INTERVAL '500 us'", + "postgres": "SELECT TIMESTAMP '2020-01-01' + INTERVAL '500 us'", + }, + ) + self.validate_all( + "SELECT CURRENT_DATE()", + read={ + "clickhouse": "SELECT CURRENT_DATE()", + "postgres": "SELECT CURRENT_DATE", + }, + ) + self.validate_all( + "SELECT CURRENT_TIMESTAMP()", + read={ + "clickhouse": "SELECT CURRENT_TIMESTAMP()", + "postgres": "SELECT CURRENT_TIMESTAMP", + }, + ) + self.validate_all( + "SELECT match('ThOmAs', CONCAT('(?i)', 'thomas'))", + read={ + "postgres": "SELECT 'ThOmAs' ~* 'thomas'", + }, + ) + self.validate_all( + "SELECT match('ThOmAs', CONCAT('(?i)', x)) FROM t", + read={ + "postgres": "SELECT 'ThOmAs' ~* x FROM t", + }, + ) self.validate_all( "SELECT '\\0'", read={ -- cgit v1.2.3