jiwen624 commented on code in PR #18812:
URL: https://github.com/apache/iceberg/pull/18812#discussion_r4534013118


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1627,14 +1631,7 @@ private int addSchemaInternal(Schema schema, int 
newLastColumnId) {
       int newSchemaId = reuseOrCreateNewSchemaId(schema);
       boolean schemaFound = schemasById.containsKey(newSchemaId);
       if (schemaFound && newLastColumnId == lastColumnId) {
-        // the new spec and last column id is already current and no change is 
needed
-        // update lastAddedSchemaId if the schema was added in this set of 
changes (since it is now
-        // the last)
-        boolean isNewSchema =
-            lastAddedSchemaId != null
-                && changes(MetadataUpdate.AddSchema.class)
-                    .anyMatch(added -> added.schema().schemaId() == 
newSchemaId);
-        this.lastAddedSchemaId = isNewSchema ? newSchemaId : null;
+        this.lastAddedSchemaId = newSchemaId;

Review Comment:
   The equivalent reuse path in `ViewMetadata` still leaves `lastAddedSchemaId` 
unset or pointing at a different schema. Should we have a follow-up for views?



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