summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_duckdb.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-20 09:22:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-20 09:22:22 +0000
commit281115ae80458761fb3593c81fe9488976b87c6d (patch)
treef159075e865f3bad227b365878dc315eeab64112 /tests/dialects/test_duckdb.py
parentAdding upstream version 18.4.1. (diff)
downloadsqlglot-281115ae80458761fb3593c81fe9488976b87c6d.tar.xz
sqlglot-281115ae80458761fb3593c81fe9488976b87c6d.zip
Adding upstream version 18.5.1.upstream/18.5.1
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.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/dialects/test_duckdb.py b/tests/dialects/test_duckdb.py
index c5ee679..36fca7c 100644
--- a/tests/dialects/test_duckdb.py
+++ b/tests/dialects/test_duckdb.py
@@ -348,6 +348,27 @@ class TestDuckDB(Validator):
"SELECT CAST('2020-05-06' AS DATE) + INTERVAL 5 DAY",
read={"bigquery": "SELECT DATE_ADD(CAST('2020-05-06' AS DATE), INTERVAL 5 DAY)"},
)
+ self.validate_all(
+ "SELECT QUANTILE_CONT(x, q) FROM t",
+ write={
+ "duckdb": "SELECT QUANTILE_CONT(x, q) FROM t",
+ "postgres": "SELECT PERCENTILE_CONT(q) WITHIN GROUP (ORDER BY x) FROM t",
+ },
+ )
+ self.validate_all(
+ "SELECT QUANTILE_DISC(x, q) FROM t",
+ write={
+ "duckdb": "SELECT QUANTILE_DISC(x, q) FROM t",
+ "postgres": "SELECT PERCENTILE_DISC(q) WITHIN GROUP (ORDER BY x) FROM t",
+ },
+ )
+ self.validate_all(
+ "SELECT MEDIAN(x) FROM t",
+ write={
+ "duckdb": "SELECT QUANTILE_CONT(x, 0.5) FROM t",
+ "postgres": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x) FROM t",
+ },
+ )
with self.assertRaises(UnsupportedError):
transpile(