shenodaguirguis commented on a change in pull request #966: Moving the Fixes from internal AvroRelConverter URL: https://github.com/apache/samza/pull/966#discussion_r268405722
########## File path: samza-sql/src/main/java/org/apache/samza/sql/avro/AvroRelConverter.java ########## @@ -271,45 +281,46 @@ public Object convertToJavaObject(Object avroObj, Schema schema) { } } - private boolean isSchemaCompatible(Object avroObj, Schema unionSchema) { - if (unionSchema.getType() == Schema.Type.NULL && avroObj == null) { - return true; + private static boolean isSchemaCompatibleWithRelObj(Object relObj, Schema unionSchema) { + if (unionSchema.getType() == Schema.Type.NULL) { + return relObj == null; } + switch (unionSchema.getType()) { case RECORD: - return avroObj instanceof IndexedRecord; + return relObj instanceof SamzaSqlRelRecord; case ARRAY: - return avroObj instanceof GenericData.Array || avroObj instanceof List; + return relObj instanceof List; case MAP: - return avroObj instanceof Map; + return relObj instanceof Map; case FIXED: - return avroObj instanceof GenericData.Fixed; + return relObj instanceof ByteString; case BYTES: - return avroObj instanceof ByteBuffer; + return relObj instanceof ByteString; case FLOAT: - return avroObj instanceof Float; + return relObj instanceof Float || relObj instanceof Double; default: return true; } } - private static boolean isSchemaCompatibleWithRelObj(Object relObj, Schema unionSchema) { - if (unionSchema.getType() == Schema.Type.NULL && relObj == null) { + private static boolean isSchemaCompatible(Object avroObj, Schema unionSchema) { + if (unionSchema.getType() == Schema.Type.NULL && avroObj == null) { Review comment: shouldn't (avroObj == null) move to be the return? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services