summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_mysql.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_mysql.py')
-rw-r--r--tests/dialects/test_mysql.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
index 19245f0..85bf261 100644
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -533,45 +533,45 @@ class TestMySQL(Validator):
self.validate_all(
"SELECT DATEDIFF(x, y)",
read={
- "presto": "SELECT DATE_DIFF('day', y, x)",
- "redshift": "SELECT DATEDIFF(day, y, x)",
+ "presto": "SELECT DATE_DIFF('DAY', y, x)",
+ "redshift": "SELECT DATEDIFF(DAY, y, x)",
},
write={
"mysql": "SELECT DATEDIFF(x, y)",
- "presto": "SELECT DATE_DIFF('day', y, x)",
- "redshift": "SELECT DATEDIFF(day, y, x)",
+ "presto": "SELECT DATE_DIFF('DAY', y, x)",
+ "redshift": "SELECT DATEDIFF(DAY, y, x)",
},
)
self.validate_all(
"DAYOFYEAR(x)",
write={
"mysql": "DAYOFYEAR(x)",
- "": "DAY_OF_YEAR(TS_OR_DS_TO_DATE(x))",
+ "": "DAY_OF_YEAR(CAST(x AS DATE))",
},
)
self.validate_all(
"DAYOFMONTH(x)",
- write={"mysql": "DAYOFMONTH(x)", "": "DAY_OF_MONTH(TS_OR_DS_TO_DATE(x))"},
+ write={"mysql": "DAYOFMONTH(x)", "": "DAY_OF_MONTH(CAST(x AS DATE))"},
)
self.validate_all(
"DAYOFWEEK(x)",
- write={"mysql": "DAYOFWEEK(x)", "": "DAY_OF_WEEK(TS_OR_DS_TO_DATE(x))"},
+ write={"mysql": "DAYOFWEEK(x)", "": "DAY_OF_WEEK(CAST(x AS DATE))"},
)
self.validate_all(
"WEEKOFYEAR(x)",
- write={"mysql": "WEEKOFYEAR(x)", "": "WEEK_OF_YEAR(TS_OR_DS_TO_DATE(x))"},
+ write={"mysql": "WEEKOFYEAR(x)", "": "WEEK_OF_YEAR(CAST(x AS DATE))"},
)
self.validate_all(
"DAY(x)",
- write={"mysql": "DAY(x)", "": "DAY(TS_OR_DS_TO_DATE(x))"},
+ write={"mysql": "DAY(x)", "": "DAY(CAST(x AS DATE))"},
)
self.validate_all(
"WEEK(x)",
- write={"mysql": "WEEK(x)", "": "WEEK(TS_OR_DS_TO_DATE(x))"},
+ write={"mysql": "WEEK(x)", "": "WEEK(CAST(x AS DATE))"},
)
self.validate_all(
"YEAR(x)",
- write={"mysql": "YEAR(x)", "": "YEAR(TS_OR_DS_TO_DATE(x))"},
+ write={"mysql": "YEAR(x)", "": "YEAR(CAST(x AS DATE))"},
)
self.validate_all(
"DATE(x)",
@@ -1005,7 +1005,7 @@ COMMENT='客户账户表'"""
self.validate_all(
"MONTHNAME(x)",
write={
- "": "TIME_TO_STR(TS_OR_DS_TO_DATE(x), '%B')",
+ "": "TIME_TO_STR(CAST(x AS DATE), '%B')",
"mysql": "DATE_FORMAT(x, '%M')",
},
)