Fokko commented on code in PR #176:
URL: https://github.com/apache/iceberg-python/pull/176#discussion_r1413327467


##########
pyiceberg/table/__init__.py:
##########
@@ -1412,13 +1412,22 @@ def commit(self) -> None:
         """Apply the pending changes and commit."""
         new_schema = self._apply()
 
-        if new_schema != self._schema:
-            last_column_id = max(self._table.metadata.last_column_id, 
new_schema.highest_field_id)
-            updates = (
-                AddSchemaUpdate(schema=new_schema, 
last_column_id=last_column_id),
-                SetCurrentSchemaUpdate(schema_id=-1),
-            )
+        existing_schema_id: Optional[int] = None
+        for schema in self._table.metadata.schemas:
+            if new_schema == schema:
+                existing_schema_id = schema.schema_id

Review Comment:
   Oh, your suggestion is beautiful, thanks!



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