Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-35482

ParquetInt64TimestampReaderTest unit tests fail due to system timezone

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.20.0, 1.19.1
    • 1.19.2, 1.20.1, 2.0-preview
    • Tests

    Description

      To reproduce:

      export TZ=Pacific/Auckland
      ./mvnw -Dfast -DskipTests -Dskip.npm=true install -pl :flink-parquet -am
      ./mvnw test -pl :flink-parquet

      The parquet tests fail with:

      [ERROR] Failures: 
      [ERROR]   ParquetInt64TimestampReaderTest.testReadInt64TimestampMicros:46 expected:<2021-11-22T1[7]:50:20.000112> but was:<2021-11-22T1[8]:50:20.000112>
      [ERROR]   ParquetInt64TimestampReaderTest.testReadInt64TimestampMillis:66 expected:<2021-11-22T1[7]:50:20> but was:<2021-11-22T1[8]:50:20>
      [ERROR]   ParquetInt64TimestampReaderTest.testReadInt64TimestampNanos:78 expected:<2021-11-22T1[7]:50:20.000112233> but was:<2021-11-22T1[8]:50:20.000112233>

      I think this is because the tests convert a LocalDateTime to epoch seconds using `OffsetDateTime.now().getOffset()` as the offset, but now's offset is different to what it would be at 2021-11-22T17:50:20.000112 NZST due to daylight savings.

      Instead of using now's offset we could convert the localDateTime to a zonedDateTime using `localDateTime.atZone(ZoneId.systemDefault())`. If you're happy with that idea please assign me and I'll make a PR.

      Another possible idea would be to set the user.timezone to GMT in the base argLine to use a consistent timezone for tests, which would be picked up by surefire and IDEA. But improving the tests feels like a better solution.

      Thanks

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            robyoung Rob Young
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: