martin-g commented on a change in pull request #1301:
URL: https://github.com/apache/avro/pull/1301#discussion_r702649923



##########
File path: lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
##########
@@ -892,6 +902,9 @@ public int resolveUnion(Schema union, Object datum) {
   protected String getSchemaName(Object datum) {
     if (datum == null || datum == JsonProperties.NULL_VALUE)
       return Type.NULL.getName();
+    String primativeType = PRIMATIVE_DATUM_TYPES.get(datum.getClass());
+    if (primativeType != null)
+      return primativeType;

Review comment:
       I am not sure whether I was clear enough.
   
https://github.com/apache/avro/blob/cc0eb0bee35681f33a0b5324b106ef744be86d1f/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java#L905-L907
 is the new `if` branch.
   If I understand it correctly if the datum is any of the "primitive" types 
then the following `if` branches won't ever be reached: 
https://github.com/apache/avro/blob/cc0eb0bee35681f33a0b5324b106ef744be86d1f/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java#L918-L931
   So, even if a user overrides `isInteger()` it won't be called at all, 
because of 
https://github.com/apache/avro/blob/cc0eb0bee35681f33a0b5324b106ef744be86d1f/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java#L905-L907
   
   




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