Adding upstream version 25.5.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
147b6e06e8
commit
4e506fbac7
136 changed files with 80990 additions and 72541 deletions
|
@ -581,6 +581,13 @@ class TestPresto(Validator):
|
|||
)
|
||||
|
||||
def test_presto(self):
|
||||
self.assertEqual(
|
||||
exp.func("md5", exp.func("concat", exp.cast("x", "text"), exp.Literal.string("s"))).sql(
|
||||
dialect="presto"
|
||||
),
|
||||
"LOWER(TO_HEX(MD5(TO_UTF8(CONCAT(CAST(x AS VARCHAR), CAST('s' AS VARCHAR))))))",
|
||||
)
|
||||
|
||||
with self.assertLogs(helper_logger):
|
||||
self.validate_all(
|
||||
"SELECT COALESCE(ELEMENT_AT(MAP_FROM_ENTRIES(ARRAY[(51, '1')]), id), quantity) FROM my_table",
|
||||
|
@ -1192,3 +1199,18 @@ MATCH_RECOGNIZE (
|
|||
"starrocks": "SIGN(x)",
|
||||
},
|
||||
)
|
||||
|
||||
def test_json_vs_row_extract(self):
|
||||
for dialect in ("trino", "presto"):
|
||||
s = parse_one('SELECT col:x:y."special string"', read="snowflake")
|
||||
|
||||
dialect_json_extract_setting = f"{dialect}, variant_extract_is_json_extract=True"
|
||||
dialect_row_access_setting = f"{dialect}, variant_extract_is_json_extract=False"
|
||||
|
||||
# By default, Snowflake VARIANT will generate JSON_EXTRACT() in Presto/Trino
|
||||
json_extract_result = """SELECT JSON_EXTRACT(col, '$.x.y["special string"]')"""
|
||||
self.assertEqual(s.sql(dialect), json_extract_result)
|
||||
self.assertEqual(s.sql(dialect_json_extract_setting), json_extract_result)
|
||||
|
||||
# If the setting is overriden to False, then generate ROW access (dot notation)
|
||||
self.assertEqual(s.sql(dialect_row_access_setting), 'SELECT col.x.y."special string"')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue