betodealmeida commented on code in PR #38617:
URL: https://github.com/apache/superset/pull/38617#discussion_r3438122248
##########
superset/db_engine_specs/mysql.py:
##########
@@ -250,7 +250,8 @@ class MySQLEngineSpec(BasicParametersMixin, BaseEngineSpec):
" + SECOND({col})) SECOND)",
TimeGrain.MINUTE: "DATE_ADD(DATE({col}), "
"INTERVAL (HOUR({col})*60 + MINUTE({col})) MINUTE)",
- TimeGrain.HOUR: "DATE_ADD(DATE({col}), INTERVAL HOUR({col}) HOUR)",
+ TimeGrain.HOUR: "DATE_ADD(CAST(DATE({col}) AS DATETIME), "
+ "INTERVAL HOUR({col}) HOUR)",
Review Comment:
It looks like we'd have to fix seconds and minutes too; but while we're at
it, can you try this simpler solution?
```python
TimeGrain.SECOND: "DATE_FORMAT({col}, '%Y-%m-%d %H:%i:%s')",
TimeGrain.MINUTE: "DATE_FORMAT({col}, '%Y-%m-%d %H:%i:00')",
TimeGrain.HOUR: "DATE_FORMAT({col}, '%Y-%m-%d %H:00:00')",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]