viirya opened a new pull request, #3678:
URL: https://github.com/apache/iceberg-rust/pull/3678

   ## Which issue does this PR close?
   
   - Closes #3677.
   
   ## What changes are included in this PR?
   
   `UpdateSchemaAction` now fails with `Cannot add to a column that will be 
deleted: <parent>` when a nested addition's target struct is inside a column 
deleted by the same update. Before, the addition was accepted and then dropped 
with the deleted subtree, so its assigned ID never reached the schema or 
`last-column-id`.
   
   This matches Java's `SchemaUpdate.addColumn` / `deleteColumn` checks. Java 
compares against the resolved parent ID (the value or element ID for a map or 
list), and only checks the direct parent, so it accepts deleting a map or list 
field, or an ancestor struct, and then drops the addition. This PR checks the 
whole deleted subtree, so those cases are rejected too. Checks run at commit 
time, so the order of `delete_column` and `add_column` doesn't matter.
   
   Related to #3665, which skips name-mapping entries for these additions as a 
workaround.
   
   ## Are these changes tested?
   
   Yes. New unit tests in `update_schema.rs`: adding to a deleted struct fails, 
adding under a deleted list or map fails, and deleting `person.name` then 
re-adding `name` under the kept `person` still works. The existing root-level 
delete-then-re-add test still passes.
   
   ## AI Disclosure
   
   Written with an AI assistant (Claude). Please check the choice to also 
reject deleted list/map fields and ancestor structs, which is stricter than 
Java. Also check that no other path in `UpdateSchemaAction` can still assign an 
ID that doesn't land in the new schema.
   
   This pull request and its description were written by Isaac.
   


-- 
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]

Reply via email to