summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-10 06:44:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-10 06:44:54 +0000
commitd2e9401b18925b5702c5c758af7d4f5b61deb493 (patch)
tree58dbf490c0457c2908751b3e4b63af13287381ee /tests/test_transpile.py
parentAdding upstream version 11.7.1. (diff)
downloadsqlglot-d2e9401b18925b5702c5c758af7d4f5b61deb493.tar.xz
sqlglot-d2e9401b18925b5702c5c758af7d4f5b61deb493.zip
Adding upstream version 12.2.0.upstream/12.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_transpile.py')
-rw-r--r--tests/test_transpile.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_transpile.py b/tests/test_transpile.py
index d68f6f8..ad8ec72 100644
--- a/tests/test_transpile.py
+++ b/tests/test_transpile.py
@@ -263,6 +263,18 @@ FROM v""",
"(/* 1 */ 1 ) /* 2 */",
"(1) /* 1 */ /* 2 */",
)
+ self.validate(
+ "select * from t where not a in (23) /*test*/ and b in (14)",
+ "SELECT * FROM t WHERE NOT a IN (23) /* test */ AND b IN (14)",
+ )
+ self.validate(
+ "select * from t where a in (23) /*test*/ and b in (14)",
+ "SELECT * FROM t WHERE a IN (23) /* test */ AND b IN (14)",
+ )
+ self.validate(
+ "select * from t where ((condition = 1)/*test*/)",
+ "SELECT * FROM t WHERE ((condition = 1) /* test */)",
+ )
def test_types(self):
self.validate("INT 1", "CAST(1 AS INT)")
@@ -324,9 +336,6 @@ FROM v""",
)
self.validate("SELECT IF(a > 1, 1) FROM foo", "SELECT CASE WHEN a > 1 THEN 1 END FROM foo")
- def test_ignore_nulls(self):
- self.validate("SELECT COUNT(x RESPECT NULLS)", "SELECT COUNT(x)")
-
def test_with(self):
self.validate(
"WITH a AS (SELECT 1) WITH b AS (SELECT 2) SELECT *",
@@ -482,7 +491,7 @@ FROM v""",
self.validate("UNIX_TO_STR(123, 'y')", "FROM_UNIXTIME(123, 'y')", write="spark")
self.validate(
"UNIX_TO_TIME(123)",
- "FROM_UNIXTIME(123)",
+ "CAST(FROM_UNIXTIME(123) AS TIMESTAMP)",
write="spark",
)
self.validate(