opwvhk commented on code in PR #1776:
URL: https://github.com/apache/avro/pull/1776#discussion_r927505765


##########
lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java:
##########
@@ -234,8 +234,16 @@ protected Object convert(Object datum, Schema schema, 
LogicalType type, Conversi
    * representations.
    */
   protected Object readRecord(Object old, Schema expected, ResolvingDecoder 
in) throws IOException {
-    final Object record = data.newRecord(old, expected);
-    final Object state = data.getRecordState(record, expected);
+    final Schema realSchema;
+    if (expected.hasChild()) {
+      int index = in.readExtends();
+      realSchema = expected.findInHierachy(index);
+    } else {
+      realSchema = expected;
+    }

Review Comment:
   This seems to be at odds with GenericDatumWriter, lines 239-241: there, the 
extends is optional, based on whether the parent schema or one of its children 
is written.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to