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

incorrect timezone handling for TIMESTAMP_WITH_LOCAL_TIME_ZONE type during predicate pushdown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.18.1
    • None
    • Table SQL / API
    • flink version 1.18.1

      iceberg version 1.15.1

    Description

      In our scenario, we have an Iceberg table that contains a column named 'time' of the timestamptz data type. This column has 10 rows of data where the 'time' value is '2024-04-30 07:00:00' expressed in the "Asia/Shanghai" timezone.

       

      We encountered a strange phenomenon when accessing the table using Iceberg-flink.

      When the WHERE clause includes the time column, the results are incorrect.

      ZoneId.systemDefault() = "Asia/Shanghai" 

      When there is no WHERE clause, the results are correct.

      During debugging, we found that when a WHERE clause is present, a FilterPushDownSpec is generated, and this FilterPushDownSpec utilizes RexNodeToExpressionConverter for translation.

      When RexNodeToExpressionConverter#visitLiteral encounters a TIMESTAMP_WITH_LOCAL_TIME_ZONE type, it uses the specified timezone "Asia/Shanghai" to convert the TimestampString type to an Instant type. However, the upstream TimestampString data has already been processed in UTC timezone. By applying the local timezone processing here, an error occurs due to the mismatch in timezones.

      Whether the handling of TIMESTAMP_WITH_LOCAL_TIME_ZONE type of data in RexNodeToExpressionConverter#visitLiteral is a bug, and whether it should process the data in UTC timezone.

       
      Please help confirm if this is the issue, and if so, we can submit a patch to fix it.
       
       

      Attachments

        1. image-2024-05-09-14-06-58-007.png
          52 kB
          linshangquan
        2. image-2024-05-09-14-09-38-453.png
          79 kB
          linshangquan
        3. image-2024-05-09-14-11-38-476.png
          167 kB
          linshangquan
        4. image-2024-05-09-14-22-14-417.png
          116 kB
          linshangquan
        5. image-2024-05-09-14-22-59-370.png
          41 kB
          linshangquan
        6. image-2024-05-09-18-52-03-741.png
          107 kB
          linshangquan
        7. image-2024-05-09-18-52-28-584.png
          102 kB
          linshangquan

        Issue Links

          Activity

            People

              linshangquan linshangquan
              linshangquan linshangquan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: