summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_duckdb.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:40 +0000
commitd7f0758e21b5111b5327f3839c5c9f49a04d272b (patch)
treea425f4ebcc159d6bd9443fe4e0e2f9eb20151027 /tests/dialects/test_duckdb.py
parentAdding upstream version 18.7.0. (diff)
downloadsqlglot-d7f0758e21b5111b5327f3839c5c9f49a04d272b.tar.xz
sqlglot-d7f0758e21b5111b5327f3839c5c9f49a04d272b.zip
Adding upstream version 18.11.2.upstream/18.11.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_duckdb.py')
-rw-r--r--tests/dialects/test_duckdb.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/dialects/test_duckdb.py b/tests/dialects/test_duckdb.py
index dbf0a87..240f6f9 100644
--- a/tests/dialects/test_duckdb.py
+++ b/tests/dialects/test_duckdb.py
@@ -10,6 +10,10 @@ class TestDuckDB(Validator):
parse_one("select * from t limit (select 5)").sql(dialect="duckdb"),
exp.select("*").from_("t").limit(exp.select("5").subquery()).sql(dialect="duckdb"),
)
+ self.assertEqual(
+ parse_one("select * from t offset (select 5)").sql(dialect="duckdb"),
+ exp.select("*").from_("t").offset(exp.select("5").subquery()).sql(dialect="duckdb"),
+ )
for struct_value in ("{'a': 1}", "struct_pack(a := 1)"):
self.validate_all(struct_value, write={"presto": UnsupportedError})
@@ -287,6 +291,8 @@ class TestDuckDB(Validator):
"duckdb": "STRUCT_EXTRACT(x, 'abc')",
"presto": "x.abc",
"hive": "x.abc",
+ "postgres": "x.abc",
+ "redshift": "x.abc",
"spark": "x.abc",
},
)
@@ -446,6 +452,7 @@ class TestDuckDB(Validator):
write={
"duckdb": "SELECT QUANTILE_CONT(x, q) FROM t",
"postgres": "SELECT PERCENTILE_CONT(q) WITHIN GROUP (ORDER BY x) FROM t",
+ "snowflake": "SELECT PERCENTILE_CONT(q) WITHIN GROUP (ORDER BY x) FROM t",
},
)
self.validate_all(
@@ -453,6 +460,7 @@ class TestDuckDB(Validator):
write={
"duckdb": "SELECT QUANTILE_DISC(x, q) FROM t",
"postgres": "SELECT PERCENTILE_DISC(q) WITHIN GROUP (ORDER BY x) FROM t",
+ "snowflake": "SELECT PERCENTILE_DISC(q) WITHIN GROUP (ORDER BY x) FROM t",
},
)
self.validate_all(
@@ -460,6 +468,7 @@ class TestDuckDB(Validator):
write={
"duckdb": "SELECT QUANTILE_CONT(x, 0.5) FROM t",
"postgres": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x) FROM t",
+ "snowflake": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x) FROM t",
},
)