wmoustafa commented on code in PR #9502: URL: https://github.com/apache/iceberg/pull/9502#discussion_r1716149183
########## core/src/main/java/org/apache/iceberg/avro/GenericAvroReader.java: ########## @@ -155,6 +162,41 @@ public ValueReader<?> record(Type partner, Schema record, List<ValueReader<?>> f return recordReader(readPlan, avroSchemas.get(partner), record.getFullName()); } + Object toGenericRecord(Type type, Object data) { + // Recursively convert data to GenericRecord if type is a StructType. + // TODO: Rewrite this as a visitor. Review Comment: While I initially intended to implement it as a visitor, it turns out none of the existing visitor patterns (`SchemaVisitor` or `SchemaWithPartnerVisitor`) is a good fit for this use case since here we are co-traversing a schema and a data object (not just a schema or two schemas). I will clean up this code instead of using a visitor. -- 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