Repository navigation
Fixing timezone option of formatDateTime - #73091
Conversation
|
This is an automated comment for commit e935b2e with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
|
Also style check has failed because of trailing spaces |
|
@alexkats I added a test (to the collection of the existing formatDateTime tests) and fixed the style check. ...but if you have a minute, I would have a question. While developing on MacOS, I failed to run the clickhouse-test script due to a Python issue and the different MacOS process model. I assume there is a way to run the tests via docker, but I need help finding good documentation. Can you please point me to a description so that I can verify the style and test it before PR in the future? Thanks! |
| select formatDateTime(toDateTime64('1969-12-31 23:59:59.999', 3, 'UTC'), '%F %T.%f'); | ||
| select formatDateTime(toDateTime64('1970-01-01 00:00:00.000', 3, 'UTC'), '%F %T.%f'); | ||
| select formatDateTime(toDateTime64('1970-01-01 00:00:00.001', 3, 'UTC'), '%F %T.%f'); | ||
| select formatDateTime(toDateTime64('2024-12-11 12:34:56.000', 3, 'UTC'), '%W%z'); |
There was a problem hiding this comment.
In general new test cases should be created in a new file. Let's do it and add a couple more tests with different time zones (both negative and positive), so we'll have this check for all the cases in the future
|
This is a general link to all the info about testing in ClickHouse: https://clickhouse.com/docs/en/development/tests |
alexkats
left a comment
There was a problem hiding this comment.
LGTM, thanks again for the changes. Waiting for CI to finish.
|
Taking a brief look, all CI failures seem unrelated to the changes. Will take a closer look later |
Backport #73091 to 24.10: Fixing timezone option of formatDateTime
Backport #73091 to 24.12: Fixing timezone option of formatDateTime
Backport #73091 to 24.11: Fixing timezone option of formatDateTime
The mysqlTimezoneOffset function, called for the formatDateTime(ts, '%W%z') scalar function only stores the '-' for negative timezone offsets but no '+' for positive offsets. The memory that is passed into this function is not necessarily initialized, so the function skips the character for the +/- and only writes the offset value. This leads to the corrupted output as described in the following issue:
Closes #72877
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix positive timezone formatting of formatDateTime scalar function.
Documentation entry for user-facing changes
n/a
CI Settings (Only check the boxes if you know what you are doing):