RussellSpitzer commented on code in PR #12855: URL: https://github.com/apache/iceberg/pull/12855#discussion_r2066994127
########## core/src/main/java/org/apache/iceberg/data/GenericRecord.java: ########## @@ -65,13 +68,36 @@ private GenericRecord(StructType struct) { this.nameToPos = NAME_MAP_CACHE.get(struct); } - private GenericRecord(GenericRecord toCopy) { + private GenericRecord(GenericRecord toCopy, boolean deepCopyValues) { this.struct = toCopy.struct; this.size = toCopy.size; - this.values = Arrays.copyOf(toCopy.values, toCopy.values.length); + if (deepCopyValues) { + this.values = new Object[toCopy.values.length]; + for (int i = 0; i < toCopy.values.length; i++) { + this.values[i] = deepCopyValue(this.struct.fields().get(i).type(), toCopy.values[i]); + } + } else { + this.values = Arrays.copyOf(toCopy.values, toCopy.values.length); + } this.nameToPos = toCopy.nameToPos; } + private Object deepCopyValue(Type type, Object value) { Review Comment: I don't think it should be an issue for Map or List, what kind of test are you writing? You should be able to test this with the "generics" implementation since it also can read into genericRecords. (Same issue for ByteBuffers) -- 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