leonardBang commented on a change in pull request #17305:
URL: https://github.com/apache/flink/pull/17305#discussion_r713532867



##########
File path: 
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowDeserializationSchema.java
##########
@@ -243,7 +243,6 @@ private Object convertAvroType(Schema schema, 
TypeInformation<?> info, Object ob
             case UNION:
                 final List<Schema> types = schema.getTypes();
                 final int size = types.size();
-                final Schema actualSchema;

Review comment:
       How about giving a meaningful `actualSchema` ?
   ```
                   final Schema actualSchema;
                   if (size == 2 && types.get(0).getType() == Schema.Type.NULL) 
{
                       actualSchema = types.get(1);
                   } else if (size == 2 && types.get(1).getType() == 
Schema.Type.NULL) {
                       actualSchema = types.get(0);
                   } else if (size == 1) {
                       actualSchema = types.get(0);
                   } else {
                       // generic type
                       return object;
                   }
                   return convertAvroType(actualSchema, info, object);
   ```




-- 
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...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to