rdblue commented on a change in pull request #2089:
URL: https://github.com/apache/iceberg/pull/2089#discussion_r567154516



##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -708,15 +716,16 @@ public TableMetadata buildReplacement(Schema 
updatedSchema, PartitionSpec update
 
     return new TableMetadata(null, formatVersion, uuid, newLocation,
         lastSequenceNumber, System.currentTimeMillis(), newLastColumnId.get(), 
freshSchema,
-        specId, specListBuilder.build(), orderId, sortOrdersBuilder.build(), 
ImmutableMap.copyOf(newProperties),
+        specId, specListBuilder.build(), Math.max(lastAssignedFieldId, 
freshSpec.lastAssignedFieldId()),

Review comment:
       I think that we need to fix the implementation of `freshSpec` because it 
doesn't accept a `lastAssignedFieldId` or reuse existing partition field IDs. 
In fact, I think what would currently happen is that the spec would be created 
independent of the rest of the table metadata and could reuse existing IDs. 
That's not good, but we also don't want to reassign all of the IDs (though that 
would be less bad).
   
   We need to create a new spec similar to how we use `assignFreshIds` for the 
schema, which will reuse IDs for existing fields and only assign new IDs for 
new fields, starting at the last assigned ID.




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

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