github-actions[bot] commented on code in PR #64795:
URL: https://github.com/apache/doris/pull/64795#discussion_r3490938913


##########
fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java:
##########
@@ -483,9 +494,29 @@ private void setStoragePolicyProperty(HashMap<String, 
String> partitionPropertie
         partitionProperties.put(PropertyAnalyzer.PROPERTIES_DATA_BASE_TIME, 
baseTime);
     }
 
+    /**
+     * For TIMESTAMPTZ partition columns, convert the border string from the 
partition's
+     * timezone to a UTC timestamp string (with +00:00 suffix). This ensures 
partition
+     * boundaries are stored as UTC timestamps, so the partition range aligns 
to
+     * 00:00:00—24:00:00 in UTC regardless of the configured partition 
timezone.
+     */
+    private static String convertToUtcTimestamp(Column column, String border, 
TimeZone timeZone) {

Review Comment:
   This normalization needs to cover the auto-partition retention cutoff as 
well. The auto branch below formats 
`ZonedDateTime.now(DateUtils.getTimeZone())` into a suffix-free 
`currentTimeStr` and passes it straight to `PartitionKey.createPartitionKey()`. 
On the scheduler thread there is no `ConnectContext`, so 
`DateUtils.getTimeZone()` falls back to the FE JVM timezone, but 
`TimestampTzLiteral.fromSessionTimeZone()` falls back to UTC when it parses 
that suffix-free value.
   
   For example, with the FE JVM timezone set to `Asia/Shanghai`, at the real 
instant `2024-06-16 20:00:00Z` the cutoff string becomes `2024-06-17 04:00:00` 
and is parsed as `2024-06-17 04:00:00+00:00`. Then an auto TIMESTAMPTZ 
partition whose upper bound is `2024-06-17 00:00:00+00:00` is treated as 
history even though it is still the current UTC-day partition, so 
`partition.retention_count` can drop it early. Please normalize 
`currentTimeStr` with the same zone used to format it, or build the cutoff 
directly as a UTC TIMESTAMPTZ literal, before comparing it with stored 
partition bounds.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to