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


##########
fe/fe-core/src/test/java/org/apache/doris/catalog/DynamicPartitionTableTest.java:
##########
@@ -2165,7 +2181,56 @@ public void testTimeStampTzDynamicPartitionWeekUnit() 
throws Exception {
                 Range<PartitionKey> range = item.getItems();
                 Assert.assertTrue("lower must be < upper",
                         range.lowerEndpoint().compareTo(range.upperEndpoint()) 
< 0);
+
+                // Partition boundaries must be at UTC midnight (hour=00)
+                // regardless of time_zone.
+                List<LiteralExpr> lowerKeys = range.lowerEndpoint().getKeys();
+                Assert.assertEquals(1, lowerKeys.size());
+                String lowerStr = lowerKeys.get(0).getStringValue();
+                Assert.assertTrue("Lower key must be UTC with +00:00 suffix: " 
+ lowerStr,
+                        lowerStr.contains("+00:00"));
+
+                List<LiteralExpr> upperKeys = range.upperEndpoint().getKeys();
+                Assert.assertEquals(1, upperKeys.size());
+                String upperStr = upperKeys.get(0).getStringValue();
+                Assert.assertTrue("Upper key must be UTC with +00:00 suffix: " 
+ upperStr,
+                        upperStr.contains("+00:00"));
+
+                // UTC midnight (00:00), regardless of time_zone.
+                String lowerHour = lowerStr.substring(11, 13);
+                Assert.assertEquals("Lower bound must be UTC midnight (00): " 
+ lowerStr,
+                        "00", lowerHour);
+                String upperHour = upperStr.substring(11, 13);
+                Assert.assertEquals("Upper bound must be UTC midnight (00): " 
+ upperStr,
+                        "00", upperHour);
+            }
+
+            // Verify the current partition (idx=0) has a week name computed
+            // from UTC, since both names and values are UTC-based.
+            // Accept either the current or previous week in case the wall 
clock
+            // rolled over between scheduler execution and this assertion.
+            ZonedDateTime utcNow = ZonedDateTime.now(ZoneOffset.UTC);

Review Comment:
   This still computes the expected weekly partition name from `utcNow`, but 
the scheduler does not name WEEK partitions from the raw current date. 
`getAddPartitionOp()` uses `prevBorderForName`, and 
`DynamicPartitionUtil.getPartitionRangeOfWeek()` first moves `idx=0` to the 
configured week start date before `getFormattedPartitionName()` formats the 
name. This is distinct from the earlier second-clock-sample race: even for one 
fixed instant, around a UTC year boundary this can reject the correct output. 
For example, at `2027-01-01 UTC`, the current week lower border is 
`2026-12-28`, so the scheduler creates `p2026_53`, while this assertion only 
accepts `p2027_01` or `p2026_52`. Please derive the expected name from the 
generated current partition lower bound, or call the same 
`getPartitionRangeString`/`getFormattedPartitionName` path used by the 
scheduler.



-- 
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