rdblue commented on code in PR #12211:
URL: https://github.com/apache/iceberg/pull/12211#discussion_r1948233450


##########
core/src/main/java/org/apache/iceberg/SchemaUpdate.java:
##########
@@ -293,23 +282,15 @@ public UpdateSchema updateColumn(String name, 
Type.PrimitiveType newType) {
 
     // merge with a rename, if present
     int fieldId = field.fieldId();
-    Types.NestedField update = updates.get(fieldId);
-    if (update != null) {
-      updates.put(
-          fieldId,
-          Types.NestedField.of(fieldId, update.isOptional(), update.name(), 
newType, update.doc()));
-    } else {
-      updates.put(
-          fieldId,
-          Types.NestedField.of(fieldId, field.isOptional(), field.name(), 
newType, field.doc()));
-    }
+    Types.NestedField newField = 
Types.NestedField.from(field).ofType(newType).build();

Review Comment:
   Now, updates always use the builder to preserve existing metadata.



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