You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flink: AvroToRowDataConverters throws IllegalArgumentException for microsecond timestamps #17075
Please describe the bug AvroToRowDataConverters.convertToTimestamp() mis-converts microsecond-precision (precision 4-6) timestamps read from Avro. For the leftover sub-millisecond microseconds (Math.floorMod(timeLong, 1000L), range 0-999), it multiplies by 1_000_000 instead of 1000 before passing the result as nanoOfMillisecond to TimestampData.fromEpochMillis(long, int) (flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/formats/avro/AvroToRowDataConverters.java line 234-236). TimestampData's constructor requires nanoOfMillisecond to be in [0, 999999]; any non-zero leftover microsecond value exceeds that bound and the call throws IllegalArgumentException.
Two sibling conversions in the same module perform the same micros-to-nanos step correctly, multiplying by 1000: StructRowData.getTimestamp() (flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java line 210) and FlinkValueReaders.TimestampMicrosReader.read() (flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkValueReaders.java line 184).
The faulty branch was added in PR #15475 ("Flink: Add Nanosecond Precision Support for Flink-Iceberg Integration").
Steps to reproduce
Read an Avro record into a RowType/LocalZonedTimestampType column with precision <= 6 where the source long has a non-zero leftover after dividing by 1000 (i.e. the value isn't aligned to a whole millisecond). Expected: the timestamp converts normally. Actual: AvroToRowDataConverters.convertToTimestamp() throws IllegalArgumentException from TimestampData.<init>.
Activity