opwvhk commented on a change in pull request #1355:
URL: https://github.com/apache/avro/pull/1355#discussion_r779365882



##########
File path: 
lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumReader.java
##########
@@ -287,6 +288,26 @@ protected void readField(Object record, Field field, 
Object oldDatum, ResolvingD
             return;
           }
         }
+
+        if (field.schema().isUnion()) {

Review comment:
       Actually, the method `getAnnotatedUnion` has 4 usages. This method 
allows creating unions for common supertypes, and is the reason unions also 
occur for other use cases than nullable fields.
   
   As a result, I think we do need to override that `GenericDatumReader#read` 
method in `ReflectDatumReader`. Maybe by directly calling an overloaded version 
with an extra type parameter (`null` in the overridden `read` method as it's 
unknown).




-- 
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