smaheshwar-pltr commented on code in PR #4522:
URL: https://github.com/apache/iceberg-python/pull/4522#discussion_r4740530042


##########
pyiceberg/table/update/__init__.py:
##########
@@ -373,12 +373,13 @@ def _(update: SetPropertiesUpdate, base_metadata: 
TableMetadata, context: _Table
 
 @_apply_table_update.register(RemovePropertiesUpdate)
 def _(update: RemovePropertiesUpdate, base_metadata: TableMetadata, context: 
_TableMetadataUpdateContext) -> TableMetadata:
-    if len(update.removals) == 0:
-        return base_metadata
-
     properties = dict(base_metadata.properties)
     for key in update.removals:
-        properties.pop(key)
+        # Ignore keys that aren't set, since a concurrent commit may have 
removed them
+        properties.pop(key, None)
+
+    if len(properties) == len(base_metadata.properties):
+        return base_metadata

Review Comment:
   Makes sense, applied both. `RemoveSnapshotRefUpdate` skips a missing ref 
because 
[`removeRef`](https://github.com/apache/iceberg/blob/f0e7de3c2f207a49ac3a241ac7346726c08c8f1b/core/src/main/java/org/apache/iceberg/TableMetadata.java#L1360-L1371)
 does, so following `removeProperties` here is the consistent choice.



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