Skip to content

branch-4.1: [fix](timestamptz) Preserve correct DST fold branch to go cross the transition point #63034 - #63091

Merged
yiguolei merged 2 commits into
branch-4.1from
auto-pick-63034-branch-4.1
May 11, 2026
Merged

branch-4.1: [fix](timestamptz) Preserve correct DST fold branch to go cross the transition point #63034#63091
yiguolei merged 2 commits into
branch-4.1from
auto-pick-63034-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #63034

…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
```
@github-actions
github-actionsBot requested a review from yiguolei as a code ownerMay 8, 2026 12:49
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 97.44% (38/39) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.49% (26365/36880)
Line Coverage54.54% (279716/512837)
Region Coverage51.81% (232386/448533)
Branch Coverage53.17% (100432/188892)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 90.00% (18/20) 🎉
Increment coverage report
Complete coverage report

@zclllyybb

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/39) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.26% (20071/37683)
Line Coverage36.78% (189292/514691)
Region Coverage33.10% (147170/444670)
Branch Coverage34.18% (64393/188407)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 97.44% (38/39) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.58% (26399/36879)
Line Coverage54.57% (279869/512860)
Region Coverage51.83% (232498/448581)
Branch Coverage53.21% (100534/188927)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 79.07% (34/43) 🎉
Increment coverage report
Complete coverage report

@yiguolei
yiguolei merged commit 3131473 into branch-4.1May 11, 2026
29 of 32 checks passed
@morningman
morningman deleted the auto-pick-63034-branch-4.1 branch July 8, 2026 14:09
Sign up for freeto 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.

3 participants

@hello-stephen@zclllyybb@yiguolei