summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-27 04:28:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-27 04:28:31 +0000
commitbe50d61f0b93ed6b4ee2aba329f998b3fab36be7 (patch)
treee02ee1e74adf0e1b3542f2c41ec917a23b943793 /tests/test_transpile.py
parentAdding upstream version 25.6.1. (diff)
downloadsqlglot-be50d61f0b93ed6b4ee2aba329f998b3fab36be7.tar.xz
sqlglot-be50d61f0b93ed6b4ee2aba329f998b3fab36be7.zip
Adding upstream version 25.7.1.upstream/25.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_transpile.py')
-rw-r--r--tests/test_transpile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_transpile.py b/tests/test_transpile.py
index b5e069a..5ea5ffe 100644
--- a/tests/test_transpile.py
+++ b/tests/test_transpile.py
@@ -561,6 +561,10 @@ FROM x""",
AND Z""",
"""SELECT X FROM catalog.db.table WHERE Y AND Z""",
)
+ self.validate(
+ """with a as /* comment */ ( select * from b) select * from a""",
+ """WITH a AS (SELECT * FROM b) /* comment */ SELECT * FROM a""",
+ )
def test_types(self):
self.validate("INT 1", "CAST(1 AS INT)")
@@ -760,7 +764,7 @@ FROM x""",
self.validate("STR_TO_TIME('x', 'y')", "DATE_PARSE('x', 'y')", write="presto")
self.validate(
"STR_TO_UNIX('x', 'y')",
- "TO_UNIXTIME(COALESCE(TRY(DATE_PARSE(CAST('x' AS VARCHAR), 'y')), PARSE_DATETIME(CAST('x' AS VARCHAR), 'y')))",
+ "TO_UNIXTIME(COALESCE(TRY(DATE_PARSE(CAST('x' AS VARCHAR), 'y')), PARSE_DATETIME(DATE_FORMAT(CAST('x' AS TIMESTAMP), 'y'), 'y')))",
write="presto",
)
self.validate("TIME_TO_STR(x, 'y')", "DATE_FORMAT(x, 'y')", write="presto")