summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_dialect.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-19 13:44:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-19 13:44:59 +0000
commitef2db38de92f2329c1c366318bddfc7e3dee8415 (patch)
treedee41de1eb0e05f2f6805b77df41a71b3aa66ec2 /tests/dialects/test_dialect.py
parentAdding upstream version 11.0.1. (diff)
downloadsqlglot-ef2db38de92f2329c1c366318bddfc7e3dee8415.tar.xz
sqlglot-ef2db38de92f2329c1c366318bddfc7e3dee8415.zip
Adding upstream version 11.1.3.upstream/11.1.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_dialect.py')
-rw-r--r--tests/dialects/test_dialect.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py
index 442fbbb..5f048da 100644
--- a/tests/dialects/test_dialect.py
+++ b/tests/dialects/test_dialect.py
@@ -573,19 +573,33 @@ class TestDialect(Validator):
self.validate_all(
"DATE_TRUNC('year', x)",
read={
+ "bigquery": "DATE_TRUNC(x, year)",
"starrocks": "DATE_TRUNC('year', x)",
+ "spark": "TRUNC(x, 'year')",
},
write={
+ "bigquery": "DATE_TRUNC(x, year)",
+ "mysql": "STR_TO_DATE(CONCAT(YEAR(x), ' 1 1'), '%Y %c %e')",
+ "postgres": "DATE_TRUNC('year', x)",
"starrocks": "DATE_TRUNC('year', x)",
+ "spark": "TRUNC(x, 'year')",
},
)
self.validate_all(
- "DATE_TRUNC(x, year)",
+ "TIMESTAMP_TRUNC(x, year)",
read={
- "bigquery": "DATE_TRUNC(x, year)",
+ "bigquery": "TIMESTAMP_TRUNC(x, year)",
+ "spark": "DATE_TRUNC('year', x)",
},
write={
- "bigquery": "DATE_TRUNC(x, year)",
+ "bigquery": "TIMESTAMP_TRUNC(x, year)",
+ "spark": "DATE_TRUNC('year', x)",
+ },
+ )
+ self.validate_all(
+ "DATE_TRUNC('millenium', x)",
+ write={
+ "mysql": UnsupportedError,
},
)
self.validate_all(