From da8fc943704a221b86f0f6938f4131f0dd679f82 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 04:50:21 +0200 Subject: Adding upstream version 23.12.1. Signed-off-by: Daniel Baumann --- tests/dialects/test_snowflake.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'tests/dialects/test_snowflake.py') diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py index b652541..1cbf68c 100644 --- a/tests/dialects/test_snowflake.py +++ b/tests/dialects/test_snowflake.py @@ -456,7 +456,7 @@ WHERE }, write={ "": f"SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x NULLS LAST){suffix}", - "duckdb": f"SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x){suffix}", + "duckdb": f"SELECT QUANTILE_CONT(x, 0.5 ORDER BY x){suffix}", "postgres": f"SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x){suffix}", "snowflake": f"SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x){suffix}", }, @@ -821,6 +821,13 @@ WHERE "snowflake": "CASE WHEN x = a OR (x IS NULL AND a IS NULL) THEN b WHEN x = c OR (x IS NULL AND c IS NULL) THEN d ELSE e END", }, ) + self.validate_all( + "SELECT LISTAGG(col1, ', ') WITHIN GROUP (ORDER BY col2) FROM t", + write={ + "duckdb": "SELECT GROUP_CONCAT(col1, ', ' ORDER BY col2) FROM t", + "snowflake": "SELECT LISTAGG(col1, ', ') WITHIN GROUP (ORDER BY col2) FROM t", + }, + ) def test_null_treatment(self): self.validate_all( @@ -1038,10 +1045,16 @@ WHERE "SELECT CAST('2019-02-28' AS DATE) + INTERVAL '1 day, 1 year'", ) - self.validate_identity("DATE(x)").assert_is(exp.Anonymous) - self.validate_identity("TO_DATE(x)").assert_is(exp.Anonymous) - self.validate_identity("TRY_TO_DATE(x)").assert_is(exp.Anonymous) + self.validate_identity("TO_DATE(x)").assert_is(exp.TsOrDsToDate) + self.validate_identity("TRY_TO_DATE(x)").assert_is(exp.TsOrDsToDate) + self.validate_all( + "DATE(x)", + write={ + "duckdb": "CAST(x AS DATE)", + "snowflake": "TO_DATE(x)", + }, + ) self.validate_all( "TO_DATE(x, 'MM-DD-YYYY')", write={ @@ -1490,7 +1503,7 @@ FROM persons AS p, LATERAL FLATTEN(input => p.c, path => 'contact') AS _flattene write={ "bigquery": "REGEXP_EXTRACT(subject, pattern, pos, occ)", "hive": "REGEXP_EXTRACT(subject, pattern, group)", - "presto": "REGEXP_EXTRACT(subject, pattern, group)", + "presto": 'REGEXP_EXTRACT(subject, pattern, "group")', "snowflake": "REGEXP_SUBSTR(subject, pattern, pos, occ, params, group)", "spark": "REGEXP_EXTRACT(subject, pattern, group)", }, -- cgit v1.2.3