Repository navigation
[1059] Write Iceberg timestamp stats in micros for millisecond columns - #1060
Open
the-other-tim-brown wants to merge 3 commits into
Open
the-other-tim-brown wants to merge 3 commits into
the-other-tim-brown wants to merge 3 commits into
Conversation
IcebergColumnStatsConverter passed timestamp stats to Iceberg as-is, but Iceberg bounds are micros and millisecond columns have millis stats, so the bounds landed in 1970. Convert by TIMESTAMP_PRECISION. testVariousOperations now also checks a filtered read on a timestamp column. The Hudi to Iceberg case is skipped because Iceberg's Parquet row-group filter misreads millis footer stats (apache/iceberg#18173).
… various operations ITs
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.
Fixes #1059
What is the purpose of the pull request
The Iceberg target wrote the column stats of millisecond timestamp columns as if they were micros, so the lower and upper bounds landed in January 1970 and Iceberg could skip data files with matching rows. This PR converts millis to micros before writing the bounds. It is the same bug #1018 fixes for the Delta Kernel target.
Brief change log
IcebergColumnStatsConverter:TIMESTAMPandTIMESTAMP_NTZbounds are converted to micros when the field'sTIMESTAMP_PRECISIONisMILLIS. Partition values already did this.TestIcebergColumnStatsConverter#testTimestampBoundsUseFieldPrecision: bounds forTIMESTAMPandTIMESTAMP_NTZ, with millis and micros precision.GenericTable#getTimestampColumn: a timestamp column for each test table.ITConversionController#testVariousOperations: also checks that a filtered read on that timestamp column returns the same rows from every target as from the source. It runs for the Hudi, Delta, Iceberg and Paimon sources.The Hudi to Iceberg case is skipped for the timestamp filter. Even with correct manifest bounds, Iceberg's Parquet row-group filter compares Hudi's raw
TIMESTAMP_MILLISfooter stats with micros literals and prunes every row group, so the read returns 0 rows: apache/iceberg#18173, with a fix in review in apache/iceberg#18321. The skip can be removed once XTable uses an Iceberg release with that fix.Verify this pull request
This change added tests and can be verified as follows:
TestIcebergColumnStatsConverter#testTimestampBoundsUseFieldPrecisionfails onmain(ts_millis ==> expected: <1710498030123000> but was: <1710498030123>) and passes with the fix.ITConversionController#testVariousOperations: 28 run, 0 failures.ITConversionController#testVariousOperationsDeltaKernelTarget, which shares the timestamp filter withtestVariousOperationsafter merging [1017] Write Delta Kernel timestamp stats in micros for millisecond columns #1018: 4 run, 0 failures.Tables already written by the Iceberg target keep the old bounds on files that were already synced. A full sync only adds and removes changed files, so deleting the target Iceberg
metadatadirectory and running a full sync rewrites them.