summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_tsql.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/dialects/test_tsql.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index a60f48d..afdd48a 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -17,7 +17,6 @@ class TestTSQL(Validator):
"spark": "SELECT CAST(`a`.`b` AS SHORT) FROM foo",
},
)
-
self.validate_all(
"CONVERT(INT, CONVERT(NUMERIC, '444.75'))",
write={
@@ -25,6 +24,33 @@ class TestTSQL(Validator):
"tsql": "CAST(CAST('444.75' AS NUMERIC) AS INTEGER)",
},
)
+ self.validate_all(
+ "STRING_AGG(x, y) WITHIN GROUP (ORDER BY z DESC)",
+ write={
+ "tsql": "STRING_AGG(x, y) WITHIN GROUP (ORDER BY z DESC)",
+ "mysql": "GROUP_CONCAT(x ORDER BY z DESC SEPARATOR y)",
+ "sqlite": "GROUP_CONCAT(x, y)",
+ "postgres": "STRING_AGG(x, y ORDER BY z DESC NULLS LAST)",
+ },
+ )
+ self.validate_all(
+ "STRING_AGG(x, '|') WITHIN GROUP (ORDER BY z ASC)",
+ write={
+ "tsql": "STRING_AGG(x, '|') WITHIN GROUP (ORDER BY z)",
+ "mysql": "GROUP_CONCAT(x ORDER BY z SEPARATOR '|')",
+ "sqlite": "GROUP_CONCAT(x, '|')",
+ "postgres": "STRING_AGG(x, '|' ORDER BY z NULLS FIRST)",
+ },
+ )
+ self.validate_all(
+ "STRING_AGG(x, '|')",
+ write={
+ "tsql": "STRING_AGG(x, '|')",
+ "mysql": "GROUP_CONCAT(x SEPARATOR '|')",
+ "sqlite": "GROUP_CONCAT(x, '|')",
+ "postgres": "STRING_AGG(x, '|')",
+ },
+ )
def test_types(self):
self.validate_identity("CAST(x AS XML)")