-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flink 1.20: Support Avro and Parquet timestamp(9), unknown, and defaults #12470
base: main
Are you sure you want to change the base?
Conversation
I'll also follow up with a PR for Parquet readers, but that depends on changes in #12463. |
5f505e7
to
0af3f01
Compare
#12463 was merged and the changes for Parquet were small, so I included them here. |
} else { | ||
return Optional.of(new MicrosToTimestampReader(desc)); | ||
} | ||
return Optional.of(new MicrosToTimestampReader(desc)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the readers were converting values to LocalDateTime
or OffsetDateTime
and then Flink would convert those values back to a (millis
, nanosOfMilli
) pair. This involved a lot of unnecessary date/time logic in both Iceberg and Flink as well as readers to produce the separate types.
Now, the conversion to Flink is direct and doesn't go through Java date/time classes. That avoids all time zone calculations and should be quicker.
LogicalTypeAnnotation annotation = primitive.getLogicalTypeAnnotation(); | ||
if (annotation != null) { | ||
Optional<ParquetValueWriter<?>> writer = | ||
annotation.accept(new LogicalTypeWriterBuilder(fType, desc)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this to use the logical annotation visitor.
This updates Flink's Avro and Parquet readers to support new timestamp(9) and unknown types.
While enabling
DataTest
cases, I found thatsupportsDefaultValues
was not enabled so default value tests were not running for Avro. After I enabled those tests, I also needed to update theRowData
assertions and also convert values to match Flink's object model in the readers by callingRowDataUtil.convertConstant
.