github-actions[bot] commented on code in PR #65219:
URL: https://github.com/apache/doris/pull/65219#discussion_r3526309945
##########
fe/fe-core/src/test/java/org/apache/doris/catalog/DynamicPartitionTableTest.java:
##########
@@ -2219,17 +2282,139 @@ public void testTimeStampTzDynamicPartitionHourUnit()
throws Exception {
Assert.assertEquals("Hour partition name length: " +
partitionName,
11, partitionName.length());
- // Verify range validity and UTC boundaries
+ // Verify range validity
Range<PartitionKey> range = item.getItems();
Assert.assertTrue("lower must be < upper",
range.lowerEndpoint().compareTo(range.upperEndpoint())
< 0);
- // With time_zone = "+00:00", partition boundaries should be
UTC timestamps
List<LiteralExpr> lowerKeys = range.lowerEndpoint().getKeys();
Assert.assertEquals(1, lowerKeys.size());
String lowerStr = lowerKeys.get(0).getStringValue();
Assert.assertTrue("Lower key must have +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 have +00:00 suffix: " +
upperStr,
+ upperStr.contains("+00:00"));
+
+ // Partition boundaries must be at whole UTC hours (0-23).
+ int lowerHour = Integer.parseInt(lowerStr.substring(11, 13));
+ Assert.assertTrue("Lower bound hour must be 0-23: " + lowerStr,
+ lowerHour >= 0 && lowerHour <= 23);
+ int upperHour = Integer.parseInt(upperStr.substring(11, 13));
+ Assert.assertTrue("Upper bound hour must be 0-23: " + upperStr,
+ upperHour >= 0 && upperHour <= 23);
+
+ // Verify adjacency using full timestamps (handles midnight
crossing)
+ if (prevLower != null) {
+ ZonedDateTime expectedNext = prevLower.plusHours(1);
+ ZonedDateTime actual = ZonedDateTime.parse(lowerStr,
+ DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ssXXX"));
+ Assert.assertEquals("Adjacent partitions' lower bounds
must differ by 1 hour",
+ expectedNext, actual);
+ ZonedDateTime expectedUpper = prevUpper.plusHours(1);
+ ZonedDateTime actualUpper = ZonedDateTime.parse(upperStr,
+ DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ssXXX"));
+ Assert.assertEquals("Adjacent partitions' upper bounds
must differ by 1 hour",
+ expectedUpper, actualUpper);
+ }
+ prevLower = ZonedDateTime.parse(lowerStr,
+ DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssXXX"));
+ prevUpper = ZonedDateTime.parse(upperStr,
+ DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssXXX"));
+ }
+
+ // Verify the current partition (idx=0) name uses the configured
+ // timezone (Asia/Shanghai), not UTC and not session timezone.
+ ZonedDateTime shanghaiNow =
ZonedDateTime.now(ZoneId.of("Asia/Shanghai"));
Review Comment:
This expectation reads the wall clock again after
`executeDynamicPartitionFirstTime()` has already sampled its own `nowTz`. If
the Asia/Shanghai hour rolls between scheduler execution and this assertion,
the scheduler can correctly create the previous hour's configured-zone name
while the test expects the next hour, so the test flakes. The day and week
tests use the same fresh-after-scheduler pattern with lower-probability
boundaries. Please derive the expected name from the generated partition
ranges/name mapping, or make the assertion boundary-tolerant, so the test
proves configured-timezone naming without depending on a second wall-clock
sample.
--
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]