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:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-06 07:48:11 +0000
commit379c6d1f52e1d311867c4f789dc389da1d9af898 (patch)
treec9ca62eb7b8b7e861cc67248850db220ad0881c9 /tests/dialects/test_presto.py
parentReleasing debian version 17.7.0-1. (diff)
downloadsqlglot-379c6d1f52e1d311867c4f789dc389da1d9af898.tar.xz
sqlglot-379c6d1f52e1d311867c4f789dc389da1d9af898.zip
Merging upstream version 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"})