Indian-boult opened a new pull request, #1014: URL: https://github.com/apache/incubator-xtable/pull/1014
Fixes #1013 ## What is the purpose of the pull request With column mapping enabled, Delta keys the per-file stats by physical column name. The Delta source looked them up by logical path. Column-mapped tables lost their stats, and after renames a column could get another column's stats, which can make Iceberg skip files it should read. This PR reads the stats by physical path, for both the Delta Standalone and Delta Kernel sources. ## Brief change log - `DeltaStatsUtils.parseColumnStatsFromJson`: map each field's logical path to its physical path, where each segment is the field's storage name, or its name when there is no storage name. Look up min, max and null count by the physical path. `DeltaStatsExtractor` and `DeltaKernelStatsExtractor` both use this method. - No fallback to the logical name. Unlike partition values, a missing key is normal in stats, for example for a column added after the file was written, and the logical name can be another column's physical name. - Tests: three cases in `TestDeltaStatsExtractor` (physical names with a nested struct, swapped names, and a re-added column of a different type), and `getCurrentSnapshotColumnMappingStatsTest` in `ITDeltaConversionSource` and `ITDeltaKernelConversionSource`. The ITs enable column mapping on a table with data, rename `a` to `a_old`, re-add `a`, and check the stats of each file. ## Verify this pull request This change added tests and can be verified as follows: - Before the fix, the three unit tests fail: empty stats, swapped stats, and a `DateTimeParseException`. Both ITs fail: in the file written before `a` was re-added, the new `a` gets range [10, 20] with 0 nulls, and `a_old` has no stats. - After the fix, all of them pass. - `./mvnw -pl xtable-core test`: 584 tests, 0 failures, 0 errors, 3 skipped. - `./mvnw -pl xtable-core -DskipUTs -Dit.test='ITDeltaConversionSource,ITDeltaKernelConversionSource,ITDeltaDeleteVectorConvert,ITConversionController#testColumnMappingEnabledDeltaToIceberg+testLateColumnMappingRenameDeltaToIceberg' verify`: 39 tests, 0 failures, 0 errors, 1 skipped. - Manually synced the table from the issue to Iceberg. Before the fix, `a IS NULL` on the Iceberg table returned 0 rows. After the fix it returns 2, matching a full scan. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
