Skip to content

Conversation

@sgrebnov
Copy link

@sgrebnov sgrebnov commented Jul 19, 2024

Which issue does this PR close?

PR addresses Timestamp unparser issue producing invalid CAST(col AS Timestamp) SQL for MySQL.

MySQL cast function does not support Timestamp for CAST and requires DATETIME

DATETIME[(M)]
Produces a DATETIME value. If the optional M value is given, it specifies the fractional seconds precision.

Tested that DATETIME correctly handles timezone information. MySQL uses the local time zone for Timestamps, so the converted value from datetime_utc is correctly shown as the original value -7 (Seattle / GMT-7 local time zone). The same applies to datetime_utc_plus_4, as it is the original value in GMT+4 time zone, so it is converted to the local time zone as the original value -11 (difference between the local time zone and UTC+4).

image

@sgrebnov sgrebnov self-assigned this Jul 19, 2024
@sgrebnov sgrebnov marked this pull request as ready for review July 19, 2024 22:06
@sgrebnov sgrebnov merged commit ffe792d into spiceai-40 Jul 21, 2024
@sgrebnov sgrebnov deleted the sgrebnov/timestamp-cast-mysql branch July 21, 2024 22:23
y-f-u pushed a commit that referenced this pull request Jul 29, 2024
* Configurable date field extraction style for unparsing (#21)

* Add support for IntervalStyle::MySQL (#18)

* Support alternate format for Int64 unparsing (SIGNED for MySQL) (#22)

* Alternate format support for Timestamp casting (DATETIME for MySQL) (#23)

* Improve

* Fix clippy and docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants