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



##########
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:
       You've pulled handling the union up from `readWithoutConversion`.
   This means that handling fields like this works, but if the dates are in an 
array of unions, it will fail (see the method `readArray` starting at line 125).
   
   It's probably better to put this logic in an overridden version of 
`GenericDatumReader#read(Object, Schema, ResolvingDecoder)`, which is called 
from `readWithoutConversion`. Granted, this applies conversion inside a method 
named "without conversion", but _the current implementation already does 
(buggy) conversions for unions_, so we won't be off worse.




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