rocco408 commented on code in PR #11419: URL: https://github.com/apache/iceberg/pull/11419#discussion_r1833914062
########## core/src/main/java/org/apache/iceberg/schema/UnionByNameVisitor.java: ########## @@ -180,6 +179,21 @@ private void updateColumn(Types.NestedField field, Types.NestedField existingFie } } + private boolean ignorableUpdate(Type newType, Type existingType) { + if (newType.isPrimitiveType()) { + if (newType.equals(existingType)) { + return true; + } + if (existingType.typeId() == Type.TypeID.LONG && newType.typeId() == Type.TypeID.INTEGER) { Review Comment: Thanks for the suggestion, but I'm getting checkstyle rule violations when adding `else if`. This is what I tried, which appears to be logically correct ```java if (newType.isPrimitiveType()) { if (newType.equals(existingType)) { return false; } else if (existingType.typeId() == Type.TypeID.LONG && newType.typeId() == Type.TypeID.INTEGER) { return false; } else if (existingType.typeId() == Type.TypeID.DOUBLE && newType.typeId() == Type.TypeID.FLOAT) { return false; } else { return true; } } return false; ``` This is what I'm inclined to go with unless you have strong opinions on an alternative. ```java if (newType.isPrimitiveType()) { if (newType.equals(existingType)) { return false; } if (existingType.typeId() == Type.TypeID.LONG && newType.typeId() == Type.TypeID.INTEGER) { return false; } if (existingType.typeId() == Type.TypeID.DOUBLE && newType.typeId() == Type.TypeID.FLOAT) { return false; } return true; } return false; ``` -- 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