diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-11 16:34:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-11 16:34:56 +0000 |
commit | 278f416d08028bd175e1d6433739461f2168f4e2 (patch) | |
tree | 12492ebc5907744b2a4297228324fcda9ee2e40f /tests/dialects/test_hive.py | |
parent | Adding upstream version 24.1.0. (diff) | |
download | sqlglot-278f416d08028bd175e1d6433739461f2168f4e2.tar.xz sqlglot-278f416d08028bd175e1d6433739461f2168f4e2.zip |
Adding upstream version 25.0.3.upstream/25.0.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_hive.py')
-rw-r--r-- | tests/dialects/test_hive.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/dialects/test_hive.py b/tests/dialects/test_hive.py index 3ebaded..0311336 100644 --- a/tests/dialects/test_hive.py +++ b/tests/dialects/test_hive.py @@ -744,6 +744,16 @@ class TestHive(Validator): "hive": "SELECT a, SUM(c) FROM t GROUP BY a, DATE_FORMAT(CAST(b AS TIMESTAMP), 'yyyy'), GROUPING SETS ((a, DATE_FORMAT(CAST(b AS TIMESTAMP), 'yyyy')), a)", }, ) + self.validate_all( + "SELECT TRUNC(CAST(ds AS TIMESTAMP), 'MONTH') AS mm FROM tbl WHERE ds BETWEEN '2023-10-01' AND '2024-02-29'", + read={ + "hive": "SELECT TRUNC(CAST(ds AS TIMESTAMP), 'MONTH') AS mm FROM tbl WHERE ds BETWEEN '2023-10-01' AND '2024-02-29'", + "presto": "SELECT DATE_TRUNC('MONTH', CAST(ds AS TIMESTAMP)) AS mm FROM tbl WHERE ds BETWEEN '2023-10-01' AND '2024-02-29'", + }, + write={ + "presto": "SELECT DATE_TRUNC('MONTH', TRY_CAST(ds AS TIMESTAMP)) AS mm FROM tbl WHERE ds BETWEEN '2023-10-01' AND '2024-02-29'", + }, + ) def test_escapes(self) -> None: self.validate_identity("'\n'", "'\\n'") |