Ok, we'll try to add some extra UTs about this. On Thu, Feb 12, 2026 at 10:20 PM Christofer Dutz <[email protected]> wrote:
> But … I was more referring to that I think it would be better, if we ran > the tests using various timezones. > I remember during my time at Timecho I repeatedly had to fix tests, that > had issues that only occurred in non-asian timezones. > > Chris > > > Von: Christofer Dutz <[email protected]> > Datum: Donnerstag, 12. Februar 2026 um 15:13 > An: [email protected] <[email protected]> > Betreff: AW: Timezone issues in test ... > > I can help you with that 😊 > > Index: > iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ExtractExpressionTest.java > IDEA additional info: > Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP > <+>UTF-8 > =================================================================== > diff --git > a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ExtractExpressionTest.java > b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ExtractExpressionTest.java > --- > a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ExtractExpressionTest.java > (revision 30d98e8dec2f3c5da02f70abb77d4ccc226c647a) > +++ > b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ExtractExpressionTest.java > (revision 5f1824107e3d14d34bcf909f99d37e3b146ed72c) > @@ -26,6 +26,12 @@ > import org.junit.BeforeClass; > import org.junit.Test; > > +import java.time.Instant; > +import java.time.LocalDateTime; > +import java.time.ZoneId; > +import java.time.ZoneOffset; > +import java.time.ZonedDateTime; > + > import static > org.apache.iotdb.db.queryengine.plan.relational.analyzer.TestUtils.assertAnalyzeSemanticException; > import static > org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanAssert.assertPlan; > import static > org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.expression; > @@ -62,11 +68,22 @@ > @Test > public void constantFoldTest() { > PlanTester planTester = new PlanTester(); > + // IoTDB parses the timestamp literal using the *current* zone offset > (which may differ from > + // the offset at the timestamp's date due to DST), then extracts the > hour using the full > + // ZoneId (which applies DST rules for the timestamp's date). > Reproduce the same logic here > + // to compute the expected hour. > + ZoneId zone = ZoneId.systemDefault(); > + ZoneOffset currentOffset = zone.getRules().getOffset(Instant.now()); > + long epochMs = > + LocalDateTime.of(2025, 7, 8, 1, 18, > 51).toInstant(currentOffset).toEpochMilli(); > + long expectedHour = > + ZonedDateTime.ofInstant(Instant.ofEpochMilli(epochMs), > zone).getHour(); > assertPlan( > planTester.createPlan("select extract(hour from 2025/07/08 > 01:18:51) from table1"), > output( > project( > - ImmutableMap.of("expr", expression(new LongLiteral("1"))), > + ImmutableMap.of( > + "expr", expression(new > LongLiteral(String.valueOf(expectedHour)))), > tableScan("testdb.table1")))); > } > > Chris > > > Von: Yuan Tian <[email protected]> > Datum: Donnerstag, 12. Februar 2026 um 14:38 > An: [email protected] <[email protected]> > Betreff: Re: Timezone issues in test ... > > Hi Chris, > > Thanks for your reporting, I will try to fix it. > > On Thu, Feb 12, 2026 at 5:53 PM Christofer Dutz <[email protected] > > > wrote: > > > In > > > > ExtractExpressionTest > > > > The issue is that the zone-offset is different now compared to the > > reference date. > > That’s because Europe is currently in daylight saving time so now we’re > at > > +2, however the offset at the reference date is +1. > > That’s causing the build to fail only during winter-time 😉 > > > > Chris > > > > > > Von: Christofer Dutz <[email protected]> > > Datum: Donnerstag, 12. Februar 2026 um 10:40 > > An: [email protected] <[email protected]> > > Betreff: Timezone issues in test ... > > > > Hi all, > > > > As I’m currently updating my fork, I noticed there are some tests in > IoTDB > > that fail if you’re not in an Asian timezone. > > > > What do you think? Would it make sense to run the tests in 2-3 time > zones? > > > > > > * > > Asian TZ > > * > > Asia +8 > > * > > Asia +16 > > > > This would help make the build stable outside of your main area? > > > > Chris > > >
