Saturate date/datetime to zero (part 2)#36656
Merged
vdimir merged 1 commit intoClickHouse:masterfrom May 2, 2022
Merged
Conversation
vdimir
approved these changes
Apr 26, 2022
Member
|
@amosbird test SELECT toDateTime(10000, 'Asia/Calcutta');
SELECT toMinute(toDateTime(10000, 'Asia/Calcutta'));
SELECT toStartOfHour(toDateTime(10000, 'Asia/Calcutta'));1970-01-01 08:16:40
16
-1970-01-01 08:00:00
+1970-01-02 00:00:00 |
f091f46 to
4d09021
Compare
Collaborator
Author
I've switched to a different implementation which saturates those date time values more naturally. |
For partial hours/minutes timezones.
4d09021 to
e81929a
Compare
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Aug 10, 2022
… flakiness It is possible for toStartOfMinute() to give different result for 0 and 59, for partial timezones (timezone that does not starts from 00:00, like Africa/Monrovia). Before ClickHouse#36656 it fails for another reason, because of overflows [1], but now it fails because it simply return different minutes. [1]: ClickHouse#29953 (comment) Simply pin the UTC there. Fixes: ClickHouse#37786 Signed-off-by: Azat Khuzhin <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For partial hours/minutes timezones.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Now date time conversion functions that generates time before 1970-01-01 00:00:00 with partial hours/minutes timezones will be saturated to zero instead of overflow. This is the continuation of #29953 which addresses #29953 (comment) . Mark as improvement because it's implementation defined behavior (and very rare case) and we are allowed to break it.