Skip to content

[fix](nereids) Fix DST spring-forward gap handling in timestamptz literal#62945

Merged
zclllyybb merged 1 commit intoapache:masterfrom
zclllyybb:fix_ttz_dst
Apr 30, 2026
Merged

[fix](nereids) Fix DST spring-forward gap handling in timestamptz literal#62945
zclllyybb merged 1 commit intoapache:masterfrom
zclllyybb:fix_ttz_dst

Conversation

@zclllyybb
Copy link
Copy Markdown
Contributor

fix wrong timestamptz result when cast through DST.
before may ignore the DST.

@zclllyybb zclllyybb added the p0_w label Apr 29, 2026
Copilot AI review requested due to automatic review settings April 29, 2026 09:29
@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?

@zclllyybb
Copy link
Copy Markdown
Contributor Author

/review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect TIMESTAMPTZ literal evaluation when the specified local timestamp falls into a DST “spring-forward” gap (e.g., America/New_York at 2024-03-10 02:30:00), ensuring the literal is resolved to the correct instant instead of effectively ignoring the gap.

Changes:

  • Replaced manual offset-difference adjustment logic in DateTimeLiteral with a LocalDateTime.atZone(...).withZoneSameInstant(...) conversion to correctly resolve DST gaps.
  • Added a regression test suite + expected output covering named-zone, explicit-offset, and session-timezone (implicit) DST-gap literals and verifying equality.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
regression-test/suites/datatype_p0/timestamptz/test_timestamptz_dst_gap.groovy New regression coverage for DST spring-forward gap behavior for TIMESTAMPTZ literals.
regression-test/data/datatype_p0/timestamptz/test_timestamptz_dst_gap.out Expected results for the new DST-gap test queries.
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteral.java Uses zone-aware conversion via withZoneSameInstant to correctly handle DST gaps during literal parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zclllyybb
Copy link
Copy Markdown
Contributor Author

run buildall

@zclllyybb
Copy link
Copy Markdown
Contributor Author

run buildall

@zclllyybb
Copy link
Copy Markdown
Contributor Author

/review

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found in this review.

Critical checkpoint conclusions:

  • Goal/test coverage: The PR targets DST spring-forward gap handling for timestamptz/date-time literals. The implementation uses Java timezone resolution via LocalDateTime.atZone(...).withZoneSameInstant(...), and the new regression test covers explicit named-zone gap, explicit offsets around the gap, and implicit session-zone gap handling.
  • Scope/focus: The change is small and focused on Nereids date/time literal timezone normalization plus one range guard.
  • Concurrency/lifecycle/config: No concurrency, special lifecycle, or configuration changes are introduced.
  • Compatibility/parallel paths: The reviewed string-literal cast and constant-folding paths continue to normalize explicit zones consistently; implicit TIMESTAMPTZ session-zone conversion already uses the same Java timezone conversion path through convert_tz.
  • Error handling/data correctness: Range validation still runs after timezone conversion, and adding year < 0 prevents converted values before year 0000 from being silently accepted.
  • Tests/results: The regression test follows the drop-before-use pattern and orders table output. I did not run the regression test in this review environment.
  • Observability/performance: No additional observability is needed for this literal parsing fix; no material performance issue found.

User focus: No additional user-provided review focus was specified.

@zclllyybb
Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@zclllyybb
Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@zclllyybb zclllyybb merged commit f920c63 into apache:master Apr 30, 2026
30 of 31 checks passed
@zclllyybb zclllyybb deleted the fix_ttz_dst branch April 30, 2026 09:00
github-actions Bot pushed a commit that referenced this pull request Apr 30, 2026
…eral (#62945)

fix wrong timestamptz result when cast through DST.
before may ignore the DST.
github-actions Bot pushed a commit that referenced this pull request Apr 30, 2026
…eral (#62945)

fix wrong timestamptz result when cast through DST.
before may ignore the DST.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.0.x dev/4.1.x p0_w reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants