summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_clickhouse.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-26 17:21:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-26 17:21:50 +0000
commit6c774776db5e016d597e582c7006ba8d27006f9d (patch)
tree8a65b7a9938002f9b152d9a6dfd150f15e402a6b /tests/dialects/test_clickhouse.py
parentAdding upstream version 18.13.0. (diff)
downloadsqlglot-6c774776db5e016d597e582c7006ba8d27006f9d.tar.xz
sqlglot-6c774776db5e016d597e582c7006ba8d27006f9d.zip
Adding upstream version 18.17.0.upstream/18.17.0
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.py49
1 files changed, 49 insertions, 0 deletions
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",
@@ -86,6 +102,39 @@ class TestClickhouse(Validator):
)
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={
"mysql": "SELECT '\0'",