smaheshwar-pltr opened a new pull request, #4522:
URL: https://github.com/apache/iceberg-python/pull/4522

   # Rationale for this change
   
   With the SQL, in-memory, Hive and Glue catalogs, PyIceberg applies a 
commit's changes to the table's latest metadata itself, rather than a REST 
server doing it. Removing a property deletes each key, so the commit fails if 
another writer removed the same property first:
   
   ```python
   txn = tbl.transaction().remove_properties("owner")
   
catalog.load_table("default.t").transaction().remove_properties("owner").commit_transaction()
   txn.commit_transaction()  # KeyError: 'owner'
   ```
   
   The property is gone either way, so this skips keys that aren't set, as REST 
catalogs and the other implementations do 
([Java](https://github.com/apache/iceberg/blob/f0e7de3c2f207a49ac3a241ac7346726c08c8f1b/core/src/main/java/org/apache/iceberg/TableMetadata.java#L1485-L1494),
 
[Rust](https://github.com/apache/iceberg-rust/blob/1be091a2135a5908537a5b45786ae7207a723aab/crates/iceberg/src/spec/table_metadata_builder.rs#L281-L310),
 
[Go](https://github.com/apache/iceberg-go/blob/9cbeca458a2e5b734f5f162fc81af267750015e5/table/metadata.go#L1162-L1177),
 
[C++](https://github.com/apache/iceberg-cpp/blob/72fbb5aef6cc5950107af385fca76b5bef9978aa/src/iceberg/table_metadata.cc#L914-L930)).
 A removal of only unset keys changes nothing, so no new metadata file is 
written.
   
   ## Are these changes tested?
   
   Yes. A catalog test covers the concurrent removal, and a unit test covers 
unset keys. A Hive integration test expected `KeyError` when removing a Hive 
Metastore parameter that Iceberg doesn't see; it now checks that the removal 
leaves the parameter in place.
   
   ## Are there any user-facing changes?
   
   Removing a property that isn't set no longer raises `KeyError`, including a 
key that was never set, as with a REST catalog.
   
   **AI Disclosure:** This PR was authored by Claude Code (Opus 5.5) but 
directed and overseen by me.
   


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