summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_presto.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-19 10:22:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-19 10:22:04 +0000
commit57c3067868d0a1da90ec0f2201dd91f031241274 (patch)
tree3b16819683e27ccbc7e7726675ab8d3e978fc8aa /tests/dialects/test_presto.py
parentAdding upstream version 11.3.6. (diff)
downloadsqlglot-57c3067868d0a1da90ec0f2201dd91f031241274.tar.xz
sqlglot-57c3067868d0a1da90ec0f2201dd91f031241274.zip
Adding upstream version 11.4.1.upstream/11.4.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.py41
1 files changed, 27 insertions, 14 deletions
diff --git a/tests/dialects/test_presto.py b/tests/dialects/test_presto.py
index bf22652..0a9111c 100644
--- a/tests/dialects/test_presto.py
+++ b/tests/dialects/test_presto.py
@@ -63,8 +63,8 @@ class TestPresto(Validator):
"bigquery": "CAST(x AS TIMESTAMPTZ)",
"duckdb": "CAST(x AS TIMESTAMPTZ(9))",
"presto": "CAST(x AS TIMESTAMP(9) WITH TIME ZONE)",
- "hive": "CAST(x AS TIMESTAMPTZ)",
- "spark": "CAST(x AS TIMESTAMPTZ)",
+ "hive": "CAST(x AS TIMESTAMP)",
+ "spark": "CAST(x AS TIMESTAMP)",
},
)
@@ -189,34 +189,38 @@ class TestPresto(Validator):
)
self.validate_all(
- "DAY_OF_WEEK(timestamp '2012-08-08 01:00')",
+ "DAY_OF_WEEK(timestamp '2012-08-08 01:00:00')",
write={
- "spark": "DAYOFWEEK(CAST('2012-08-08 01:00' AS TIMESTAMP))",
- "presto": "DAY_OF_WEEK(CAST('2012-08-08 01:00' AS TIMESTAMP))",
+ "spark": "DAYOFWEEK(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "presto": "DAY_OF_WEEK(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "duckdb": "DAYOFWEEK(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
},
)
self.validate_all(
- "DAY_OF_MONTH(timestamp '2012-08-08 01:00')",
+ "DAY_OF_MONTH(timestamp '2012-08-08 01:00:00')",
write={
- "spark": "DAYOFMONTH(CAST('2012-08-08 01:00' AS TIMESTAMP))",
- "presto": "DAY_OF_MONTH(CAST('2012-08-08 01:00' AS TIMESTAMP))",
+ "spark": "DAYOFMONTH(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "presto": "DAY_OF_MONTH(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "duckdb": "DAYOFMONTH(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
},
)
self.validate_all(
- "DAY_OF_YEAR(timestamp '2012-08-08 01:00')",
+ "DAY_OF_YEAR(timestamp '2012-08-08 01:00:00')",
write={
- "spark": "DAYOFYEAR(CAST('2012-08-08 01:00' AS TIMESTAMP))",
- "presto": "DAY_OF_YEAR(CAST('2012-08-08 01:00' AS TIMESTAMP))",
+ "spark": "DAYOFYEAR(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "presto": "DAY_OF_YEAR(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "duckdb": "DAYOFYEAR(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
},
)
self.validate_all(
- "WEEK_OF_YEAR(timestamp '2012-08-08 01:00')",
+ "WEEK_OF_YEAR(timestamp '2012-08-08 01:00:00')",
write={
- "spark": "WEEKOFYEAR(CAST('2012-08-08 01:00' AS TIMESTAMP))",
- "presto": "WEEK_OF_YEAR(CAST('2012-08-08 01:00' AS TIMESTAMP))",
+ "spark": "WEEKOFYEAR(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "presto": "WEEK_OF_YEAR(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
+ "duckdb": "WEEKOFYEAR(CAST('2012-08-08 01:00:00' AS TIMESTAMP))",
},
)
@@ -366,6 +370,15 @@ class TestPresto(Validator):
self.validate_identity("APPROX_PERCENTILE(a, b, c, d)")
self.validate_all(
+ "ARRAY_AGG(x ORDER BY y DESC)",
+ write={
+ "hive": "COLLECT_LIST(x)",
+ "presto": "ARRAY_AGG(x ORDER BY y DESC)",
+ "spark": "COLLECT_LIST(x)",
+ "trino": "ARRAY_AGG(x ORDER BY y DESC)",
+ },
+ )
+ self.validate_all(
"SELECT a FROM t GROUP BY a, ROLLUP(b), ROLLUP(c), ROLLUP(d)",
write={
"presto": "SELECT a FROM t GROUP BY a, ROLLUP (b, c, d)",