diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-31 07:55:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-31 07:55:41 +0000 |
commit | 10c2aed88097d8c5495cdd00d975eb422c85f52a (patch) | |
tree | c723d62f54d831e40f80b91ba2c4edd52687335b /tests/dialects/test_clickhouse.py | |
parent | Releasing debian version 25.7.1-1. (diff) | |
download | sqlglot-10c2aed88097d8c5495cdd00d975eb422c85f52a.tar.xz sqlglot-10c2aed88097d8c5495cdd00d975eb422c85f52a.zip |
Merging upstream version 25.8.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/dialects/test_clickhouse.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py index 92fbd4b..2356ad0 100644 --- a/tests/dialects/test_clickhouse.py +++ b/tests/dialects/test_clickhouse.py @@ -28,6 +28,8 @@ class TestClickhouse(Validator): self.assertEqual(expr.sql(dialect="clickhouse"), "COUNT(x)") self.assertIsNone(expr._meta) + self.validate_identity("SELECT STR_TO_DATE(str, fmt, tz)") + self.validate_identity("SELECT STR_TO_DATE('05 12 2000', '%d %m %Y')") self.validate_identity("SELECT EXTRACT(YEAR FROM toDateTime('2023-02-01'))") self.validate_identity("extract(haystack, pattern)") self.validate_identity("SELECT * FROM x LIMIT 1 UNION ALL SELECT * FROM y") @@ -154,6 +156,17 @@ class TestClickhouse(Validator): ) self.validate_all( + "SELECT CAST(STR_TO_DATE('05 12 2000', '%d %m %Y') AS DATE)", + read={ + "clickhouse": "SELECT CAST(STR_TO_DATE('05 12 2000', '%d %m %Y') AS DATE)", + "postgres": "SELECT TO_DATE('05 12 2000', 'DD MM YYYY')", + }, + write={ + "clickhouse": "SELECT CAST(STR_TO_DATE('05 12 2000', '%d %m %Y') AS DATE)", + "postgres": "SELECT CAST(CAST(TO_DATE('05 12 2000', 'DD MM YYYY') AS TIMESTAMP) AS DATE)", + }, + ) + self.validate_all( "SELECT * FROM x PREWHERE y = 1 WHERE z = 2", write={ "": "SELECT * FROM x WHERE z = 2", |