sgrebnov opened a new pull request, #14407:
URL: https://github.com/apache/datafusion/pull/14407
## Which issue does this PR close?
Unparser dialects specify timestamp data type overrides via
`timestamp_cast_dtype` which is NOT currently used when converting timestamp
literals resulting in `syntax error near TIMESTAMP` error for MySQL
```sql
SELECT CAST('2025-01-31 01:05:49.123' AS TIMESTAMP)
SQL Error [1064] [42000]: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near 'TIMESTAMP))
```
## What changes are included in this PR?
PR updates `handle_timestamp` using in `scalar_to_sql` to respect dialect
timestamp type overrides.
## Are these changes tested?
Yes, manually and added unit test.
## Are there any user-facing changes?
Unparser will generated valid sql for timestamp literals conversion for
dialects specifying custom data type for timestamp conversion
(`timestamp_cast_dtype`)
--
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]