hozan23 opened a new pull request, #26886:
URL: https://github.com/apache/datafusion/pull/26886
## Which issue does this PR close?
- Closes #26885.
## Rationale for this change
`MySqlDialect` unparses every timestamp cast as `DATETIME`, which MySQL
treats as `DATETIME(0)`. Sub-second values are rounded to whole seconds.
See https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html
## What changes are included in this PR?
`MySqlDialect::timestamp_cast_dtype` derives the precision from the time
unit: `DATETIME` for seconds, `DATETIME(3)` for milliseconds, and `DATETIME(6)`
for micro- and nanoseconds (MySQL allows at most 6).
## What is the testing strategy for this PR?
New unit test `mysql_timestamp_cast_keeps_fractional_precision` in
`datafusion/sql/src/unparser/expr.rs`.
## Are there any user-facing changes?
No API changes.
--
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]