branch-4.1: [fix](timestamptz) Preserve correct DST fold branch to go cross the transition point #63034#63091
Open
github-actions[bot] wants to merge 1 commit intobranch-4.1from
Open
branch-4.1: [fix](timestamptz) Preserve correct DST fold branch to go cross the transition point #63034#63091github-actions[bot] wants to merge 1 commit intobranch-4.1from
github-actions[bot] wants to merge 1 commit intobranch-4.1from
Conversation
…ransition point (#63034) Problem Summary: TIMESTAMPTZ values in a DST fold hour could be converted through an ambiguous local time, making explicit post-fold instants use the earlier branch during FE literal handling and BE floor/ceil/date_trunc execution. The old code would treat DST repeated hours like `2024-11-03 01:xx` as local civil time without offset when parsing TIMESTAMPTZ with explicit offset in FE, and when BE converts local time to UTC using date_trunc/floor/ceil, it would lose the `-04/-05` offset branch information and default to the earlier branch. After the fix, FE directly constructs TimestampTzLiteral from timezone-aware strings, and BE uses the original UTC instant's offset to select pre/post branches when converting repeated hours back to UTC, thus preserving the correct fold branch. when `time_zone = 'America/New_York'`: ```sql SELECT CAST(CAST('2024-11-03 01:05:00 -05:00' AS TIMESTAMPTZ(6)) AS VARCHAR(64)) AS ts, CAST(date_trunc(CAST('2024-11-03 01:05:30 -05:00' AS TIMESTAMPTZ(6)), 'hour') AS VARCHAR(64)) AS hour_trunc; ``` before: ``` ts hour_trunc 2024-11-03 01:05:00.000000-04:00 2024-11-03 01:00:00.000000-04:00 ``` now: ``` ts hour_trunc 2024-11-03 01:05:00.000000-05:00 2024-11-03 01:00:00.000000-05:00 ```
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
FE Regression Coverage ReportIncrement line coverage |
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.
Cherry-picked from #63034