branch-4.1: [fix](fe) Accept spaced TIMESTAMPTZ offsets in range partition bounds - #66292
Merged
Conversation
…che#64795) [fix](timestamptz) Fix TIMESTAMPTZ dynamic partition boundaries not aligned to UTC midnight (apache#65219) Related PR: apache#64795 Problem Summary: When a table has a `TIMESTAMPTZ` partition column and `dynamic_partition.time_zone` is set to a non-UTC timezone (e.g., `Asia/Shanghai`), the dynamically created partition boundaries are shifted to midnight in the configured timezone rather than UTC midnight. **Root cause:** `getAddPartitionOp()` computed the current date (`now`) in the configured timezone, then `convertToUtcTimestamp()` interpreted the resulting date string as midnight in that timezone and converted it to UTC — producing a timezone-offset hour (e.g., 16:00) instead of UTC midnight (00:00). Both the `now` computation and the timezone used in `convertToUtcTimestamp()` needed to be fixed. In `DynamicPartitionScheduler.getAddPartitionOp()`, decouple the time references for boundary computation and naming: 1. **Boundary computation**: For `TIMESTAMPTZ`, use `ZonedDateTime.now(UTC)` for the current clock and pass UTC as the source timezone to `convertToUtcTimestamp()`. This ensures partition boundaries are at UTC midnight (00:00–24:00) regardless of `dynamic_partition.time_zone`. 2. **Partition naming**: For TIMESTAMPTZ columns, partition names are now generated from the same UTC-based clock as partition boundary values, via a shared setupDynamicPartitionTime() context. This keeps names and values consistent — both reflect UTC 00:00–24:00 boundaries — instead of the previous approach where names used the configured timezone's wall clock while values used UTC, which could misalign at timezone boundaries (e.g., a day partition named p20270101 but spanning [[2027-01-01 08:00 UTC, 2027-01-02 08:00 UTC) under Asia/Shanghai). For non-TIMESTAMPTZ columns, the dynamic_partition.time_zone property continues to control naming (e.g., week-of-year computation for week partitions) as before. 3. **Storage properties**: `setStorageMediumProperty()` and `setStoragePolicyProperty()` also use the configured-timezone `nowTz` so hot partition determination stays consistent with naming.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
yiguolei
approved these changes
Jul 30, 2026
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
Contributor
|
skip buildall |
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.
pick #64795 and #65219