summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-27 04:28:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-27 04:28:46 +0000
commit5ea8d03c1f8c144680c4694c2efad762f963cfa6 (patch)
treebc731c9b6562a0ee640f4d6879c6aa89fe869056 /tests/test_transpile.py
parentReleasing debian version 25.6.1-1. (diff)
downloadsqlglot-5ea8d03c1f8c144680c4694c2efad762f963cfa6.tar.xz
sqlglot-5ea8d03c1f8c144680c4694c2efad762f963cfa6.zip
Merging upstream version 25.7.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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")