Indian-boult opened a new pull request, #1016: URL: https://github.com/apache/incubator-xtable/pull/1016
Fixes #1015 ## What is the purpose of the pull request The Paimon source read each data file's stats by position in the snapshot schema, but Paimon stores them by position in the schema the file was written with. After a schema change this failed the sync (`ADD COLUMN`) or gave a column the stats of another column (`DROP` then `ADD`, or a type change). This PR reads the stats by the file's schema and matches columns by field id. ## Brief change log - `PaimonDataFileExtractor`: look up the schema of each data file by `DataFileMeta#schemaId()`, reading each schema once per sync call, and pass it to the stats extractor. - `PaimonStatsExtractor.extractColumnStats`: when `valueStatsCols()` is null, take the column names from the file's schema. Match the file's columns to the snapshot schema by field id. Skip a column that was dropped, or whose type or type parameters changed. - Tests in `TestPaimonStatsExtractor`: add a column (append and primary-key tables), rename then add, drop then add, and a type change. Each writes a file before the change and checks its stats after. ## Verify this pull request This change added tests and can be verified as follows: - Before the fix, the three add-column tests fail with `Mismatch between column stats names and values arity`, the drop and add test reports stats for `c` from `b`, and the type change test reports stats for `a` and `f` from the old types. - After the fix, they pass. - `./mvnw -pl xtable-core test`: 586 tests, 0 failures, 0 errors, 3 skipped. - `./mvnw -pl xtable-core -DskipUTs -Dit.test='ITConversionController#testVariousOperations' verify`: 28 tests, 0 failures, 0 errors. - Manually synced the tables from the issue to Iceberg, Delta and Hudi. Before the fix the add-column table failed to sync and `c IS NULL` returned 0 rows on the drop and add table. After the fix all syncs succeed and `c IS NULL` returns 2 rows. -- 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]
