summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_trino.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_trino.py')
-rw-r--r--tests/dialects/test_trino.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/dialects/test_trino.py b/tests/dialects/test_trino.py
index 33a0229..8e968e9 100644
--- a/tests/dialects/test_trino.py
+++ b/tests/dialects/test_trino.py
@@ -9,9 +9,30 @@ class TestTrino(Validator):
self.validate_identity("JSON_QUERY(content, 'lax $.HY.*')")
self.validate_identity("JSON_QUERY(content, 'strict $.HY.*' WITH UNCONDITIONAL WRAPPER)")
self.validate_identity("JSON_QUERY(content, 'strict $.HY.*' WITHOUT CONDITIONAL WRAPPER)")
+
+ def test_listagg(self):
self.validate_identity(
"SELECT LISTAGG(DISTINCT col, ',') WITHIN GROUP (ORDER BY col ASC) FROM tbl"
)
+ self.validate_identity(
+ "SELECT LISTAGG(col, '; ' ON OVERFLOW ERROR) WITHIN GROUP (ORDER BY col ASC) FROM tbl"
+ )
+ self.validate_identity(
+ "SELECT LISTAGG(col, '; ' ON OVERFLOW TRUNCATE WITH COUNT) WITHIN GROUP (ORDER BY col ASC) FROM tbl"
+ )
+ self.validate_identity(
+ "SELECT LISTAGG(col, '; ' ON OVERFLOW TRUNCATE WITHOUT COUNT) WITHIN GROUP (ORDER BY col ASC) FROM tbl"
+ )
+ self.validate_identity(
+ "SELECT LISTAGG(col, '; ' ON OVERFLOW TRUNCATE '...' WITH COUNT) WITHIN GROUP (ORDER BY col ASC) FROM tbl"
+ )
+ self.validate_identity(
+ "SELECT LISTAGG(col, '; ' ON OVERFLOW TRUNCATE '...' WITHOUT COUNT) WITHIN GROUP (ORDER BY col ASC) FROM tbl"
+ )
+ self.validate_identity(
+ "SELECT LISTAGG(col) WITHIN GROUP (ORDER BY col DESC) FROM tbl",
+ "SELECT LISTAGG(col, ',') WITHIN GROUP (ORDER BY col DESC) FROM tbl",
+ )
def test_trim(self):
self.validate_identity("SELECT TRIM('!' FROM '!foo!')")