1
0
Fork 0

Merging upstream version 12.2.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 15:53:39 +01:00
parent fffa0d5761
commit 62b2b24d3b
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
100 changed files with 35022 additions and 30936 deletions

View file

@ -6,6 +6,26 @@ class TestPresto(Validator):
dialect = "presto"
def test_cast(self):
self.validate_all(
"FROM_BASE64(x)",
read={
"hive": "UNBASE64(x)",
},
write={
"hive": "UNBASE64(x)",
"presto": "FROM_BASE64(x)",
},
)
self.validate_all(
"TO_BASE64(x)",
read={
"hive": "BASE64(x)",
},
write={
"hive": "BASE64(x)",
"presto": "TO_BASE64(x)",
},
)
self.validate_all(
"CAST(a AS ARRAY(INT))",
write={
@ -105,6 +125,13 @@ class TestPresto(Validator):
"spark": "SIZE(x)",
},
)
self.validate_all(
"ARRAY_JOIN(x, '-', 'a')",
write={
"hive": "CONCAT_WS('-', x)",
"spark": "ARRAY_JOIN(x, '-', 'a')",
},
)
def test_interval_plural_to_singular(self):
# Microseconds, weeks and quarters are not supported in Presto/Trino INTERVAL literals
@ -133,6 +160,14 @@ class TestPresto(Validator):
self.validate_identity("TRIM(a, b)")
self.validate_identity("VAR_POP(a)")
self.validate_all(
"SELECT FROM_UNIXTIME(col) FROM tbl",
write={
"presto": "SELECT FROM_UNIXTIME(col) FROM tbl",
"spark": "SELECT CAST(FROM_UNIXTIME(col) AS TIMESTAMP) FROM tbl",
"trino": "SELECT FROM_UNIXTIME(col) FROM tbl",
},
)
self.validate_all(
"DATE_FORMAT(x, '%Y-%m-%d %H:%i:%S')",
write={
@ -181,7 +216,7 @@ class TestPresto(Validator):
"duckdb": "TO_TIMESTAMP(x)",
"presto": "FROM_UNIXTIME(x)",
"hive": "FROM_UNIXTIME(x)",
"spark": "FROM_UNIXTIME(x)",
"spark": "CAST(FROM_UNIXTIME(x) AS TIMESTAMP)",
},
)
self.validate_all(
@ -583,6 +618,14 @@ class TestPresto(Validator):
},
)
self.validate_all(
"JSON_FORMAT(JSON 'x')",
write={
"presto": "JSON_FORMAT(CAST('x' AS JSON))",
"spark": "TO_JSON('x')",
},
)
def test_encode_decode(self):
self.validate_all(
"TO_UTF8(x)",