summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_presto.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-06 07:48:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-06 07:48:08 +0000
commitb737ee75da2515a4a53956e41ae85e29dd67f21d (patch)
tree3896f4cac8aebc31f5cdb32a111fa801aba7ca22 /tests/dialects/test_presto.py
parentAdding upstream version 17.7.0. (diff)
downloadsqlglot-b737ee75da2515a4a53956e41ae85e29dd67f21d.tar.xz
sqlglot-b737ee75da2515a4a53956e41ae85e29dd67f21d.zip
Adding upstream version 17.9.1.upstream/17.9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_presto.py')
-rw-r--r--tests/dialects/test_presto.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/dialects/test_presto.py b/tests/dialects/test_presto.py
index c0b77a3..a2800bd 100644
--- a/tests/dialects/test_presto.py
+++ b/tests/dialects/test_presto.py
@@ -109,6 +109,8 @@ class TestPresto(Validator):
"spark": "CAST(x AS TIMESTAMP)",
},
)
+ self.validate_identity("CAST(x AS IPADDRESS)")
+ self.validate_identity("CAST(x AS IPPREFIX)")
def test_regex(self):
self.validate_all(
@@ -459,6 +461,25 @@ class TestPresto(Validator):
self.validate_identity("START TRANSACTION ISOLATION LEVEL REPEATABLE READ")
self.validate_identity("APPROX_PERCENTILE(a, b, c, d)")
+ self.validate_all(
+ "STARTS_WITH('abc', 'a')",
+ read={"spark": "STARTSWITH('abc', 'a')"},
+ write={
+ "presto": "STARTS_WITH('abc', 'a')",
+ "spark": "STARTSWITH('abc', 'a')",
+ },
+ )
+ self.validate_all(
+ "IS_NAN(x)",
+ read={
+ "spark": "ISNAN(x)",
+ },
+ write={
+ "presto": "IS_NAN(x)",
+ "spark": "ISNAN(x)",
+ "spark2": "ISNAN(x)",
+ },
+ )
self.validate_all("VALUES 1, 2, 3", write={"presto": "VALUES (1), (2), (3)"})
self.validate_all("INTERVAL '1 day'", write={"trino": "INTERVAL '1' day"})
self.validate_all("(5 * INTERVAL '7' day)", read={"": "INTERVAL '5' week"})