Repository navigation
Conversation
Avro's local-timestamp-millis and local-timestamp-micros were converted to LONG, since Hudi 0.x wrote them to Parquet as plain INT64. Hudi 1.x writes them as Parquet timestamps that are not adjusted to UTC. The Iceberg schema of a table with a TIMESTAMP_NTZ column therefore said long for a column whose files hold a timestamp, and every Iceberg read of the table failed with a ClassCastException from LongType to TimestampType. Both logical types now convert to TIMESTAMP_NTZ and keep their precision, which the Iceberg schema extractor already turns into a timestamp without zone. TestAvroSchemaConverter expects the new type, and a new case in TestHudiSchemaExtractor converts a Hudi schema with both logical types to the internal schema and on to Iceberg. The helpers of ITIcebergTableFormat and ITConversionController that pick the columns to compare read these columns from Iceberg as longs and now read them as timestamps, as they do from Hudi. The Delta target now writes these columns as TIMESTAMP_NTZ too, so ITConversionController converts its side the same way.
This branch has not been deployed
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.
Important Read
Closes #1048, part of #722.
What is the purpose of the pull request
Avro
local-timestamp-millisandlocal-timestamp-microsconvert to TIMESTAMP_NTZ with their precision instead of LONG, since Hudi 1.x writes them as Parquet timestamps not adjusted to UTC and Iceberg reads of such tables failed with a ClassCastException.Brief change log
AvroSchemaConvertermaps both logical types to TIMESTAMP_NTZ.ITIcebergTableFormatandITConversionControllerread these columns as timestamps from Hudi, Iceberg and Delta.Known limitations:
timestampNtztable feature.Verify this pull request
This change added tests and can be verified as follows:
TestAvroSchemaConverterexpects the new type, and a new case inTestHudiSchemaExtractorconverts a Hudi schema with both logical types to the internal schema and on to Iceberg.ITConversionControllerandITIcebergTableFormatcompare the columns across formats.xtable-coreunit tests pass (3 skipped), all 80ITConversionControllercases and thextable-coreIceberg ITs pass, and the Iceberg table format's 26 unit tests and 46 ITs pass (1 skipped).ITConversionServiceinxtable-servicekeeps its own copy of the comparison helper, which still divides the Iceberg local timestamp columns by 1000 and now fails on TIMESTAMP_NTZ; it needs the same change asITConversionController. The first run also hit a flakyTestPaimonStatsExtractorcase.