Flink: Fix micros-to-nanos scaling in AvroToRowDataConverters timestamp#17078
Open
thswlsqls wants to merge 1 commit into
Open
Flink: Fix micros-to-nanos scaling in AvroToRowDataConverters timestamp#17078thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
convertToTimestamp() multiplied the leftover sub-millisecond microseconds by 1_000_000 instead of 1000 before passing them as nanoOfMillisecond to TimestampData.fromEpochMillis(long, int), whose constructor requires that argument in [0, 999999]. Any non-zero leftover microsecond value overflowed that bound and threw IllegalArgumentException on read. Matches the sibling conversions in StructRowData.getTimestamp() and FlinkValueReaders.TimestampMicrosReader.read(), which already scale by 1000. Generated-by: Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17075
Summary
AvroToRowDataConverters.convertToTimestamp()multiplied the leftover sub-millisecond microseconds by1_000_000instead of1000before passing them asnanoOfMillisecondtoTimestampData.fromEpochMillis(long, int).TimestampData's constructor requiresnanoOfMillisecondin[0, 999999]; any non-zero leftover microsecond value overflowed that bound, throwingIllegalArgumentExceptionon read.1000:StructRowData.getTimestamp()andFlinkValueReaders.TimestampMicrosReader.read().precision <= 6) path is affected, not the nanosecond path.Testing done
TestAvroToRowDataConverters#microsWithSubMillisecondComponentand#microsAlignedToMillisecond— the first fails withIllegalArgumentExceptionbefore this fix and passes after; the second (millisecond-aligned input) passes both before and after, confirming no regression../gradlew :iceberg-flink:iceberg-flink-2.1:test --tests TestAvroToRowDataConverters --tests TestAvroGenericRecordToRowDataMapper --tests TestFlinkAvroReaderWriter— all passed, covering the new test and other Avro-conversion call sites../gradlew :iceberg-flink:iceberg-flink-2.1:spotlessCheck :iceberg-flink:iceberg-flink-2.1:checkstyleMain :iceberg-flink:iceberg-flink-2.1:checkstyleTest— passed. The module's full:check(MiniCluster-based) was skipped due to its runtime; the targeted tests above cover the change and its call sites.