imtzer commented on code in PR #12202: URL: https://github.com/apache/iceberg/pull/12202#discussion_r1950228939
########## core/src/main/java/org/apache/iceberg/SchemaUpdate.java: ########## @@ -391,13 +391,14 @@ private Integer findForMove(String name) { if (addedId != null) { return addedId; } + Types.NestedField field = findFieldFromUpdateFirst(name); + return field != null ? field.fieldId() : null; + } - Types.NestedField field = findField(name); - if (field != null) { - return field.fieldId(); - } - - return null; + private Types.NestedField findFieldFromUpdateFirst(String name) { + List<Types.NestedField> updatedFields = + updates.values().stream().filter(f -> f.name().equals(name)).collect(Collectors.toList()); Review Comment: > nit: The size of `updatedFields` should be 0 or 1, right? How about verifying the size with `Preconditions.checkArgument` method? Thanks for review! I have thought about the size of `updatedFields` before, as you say it should be 0 or 1, but if your call `renameColumn` for different column to a same name , the size will greater than 1, but validation has been set in `applyChanges`, so I don't add a `Preconditions.checkArgument` Should I add a `Preconditions.checkArgument`? Add would be better, validate violation at method call -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org