Anurag-S1ngh opened a new pull request, #19276: URL: https://github.com/apache/iceberg/pull/19276
## Summary - `TableMetadata.buildReplacement` maps the replacement schema onto the existing schema by name and reuses a field ID whenever the name matches. A `REPLACE TABLE` can therefore change a column from INT to DATE while keeping its ID, so a branch that reads old data with the current schema decodes the old values as the new type. - Reuse a base field ID only when the new type is equal, a valid promotion, a file type, or a nested type of the same kind. Otherwise assign a fresh ID. Old snapshots keep their schema and the replaced column reads as NULL where it has no data. ## Changes - `AssignFreshIds.idFor`: gate ID reuse on type compatibility. - Add `AssignFreshIds.canReuseId` for equal types, allowed promotions, file types, and same-kind nested types. - `TestReplaceTransaction`: cover an incompatible STRING to DATE replacement and a compatible INT to LONG promotion. ## Testing - `./gradlew :iceberg-api:test` passes. - `./gradlew :iceberg-core:test --tests "org.apache.iceberg.TestReplaceTransaction" --tests "org.apache.iceberg.TestTransaction"` passes. - The incompatible replacement test fails on the unmodified code for format versions 1, 2, and 3. - `spotlessApply` run for the API and core modules. Closes #19269 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
