aokolnychyi commented on code in PR #9629: URL: https://github.com/apache/iceberg/pull/9629#discussion_r1476862386
########## core/src/main/java/org/apache/iceberg/PartitionData.java: ########## @@ -221,4 +223,32 @@ public static Object[] copyData(Types.StructType type, Object[] data) { return copy; } + + private static Object[] copyData(Types.StructType type, StructLike partition) { + List<Types.NestedField> fields = type.fields(); + Object[] data = new Object[fields.size()]; + + for (int pos = 0; pos < fields.size(); pos++) { + Types.NestedField field = fields.get(pos); + Class<?> javaClass = field.type().typeId().javaClass(); + data[pos] = toInternalValue(partition.get(pos, javaClass)); + } + + return data; + } + + private static Object toInternalValue(Object value) { Review Comment: Moved from `set` to avoid calling that public method in constructor. ########## core/src/main/java/org/apache/iceberg/PartitionData.java: ########## @@ -221,4 +223,32 @@ public static Object[] copyData(Types.StructType type, Object[] data) { return copy; } + + private static Object[] copyData(Types.StructType type, StructLike partition) { + List<Types.NestedField> fields = type.fields(); + Object[] data = new Object[fields.size()]; + + for (int pos = 0; pos < fields.size(); pos++) { + Types.NestedField field = fields.get(pos); + Class<?> javaClass = field.type().typeId().javaClass(); + data[pos] = toInternalValue(partition.get(pos, javaClass)); + } + + return data; + } + + private static Object toInternalValue(Object value) { Review Comment: Moved from `set` to avoid calling that public method in the new constructor. -- 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