private static boolean isSchemaCompatibleWithAvroObj(Object avroObj, Schema unionSchema) {
    Validate.notNull(unionSchema, "Schema cannot be null");
    if (unionSchema.getType() == Schema.Type.NULL) {
      return avroObj == null;
    }
    switch (unionSchema.getType()) {
      case RECORD:
        return avroObj instanceof IndexedRecord;
      case ARRAY:
        return avroObj instanceof GenericData.Array || avroObj instanceof List;
      case MAP:
        return avroObj instanceof Map;
      case FIXED:
        return avroObj instanceof GenericData.Fixed;
      case BYTES:
        return avroObj instanceof ByteBuffer;
      default:
        return true;
    }
  }
It is possible that the destination Avro schema doesn't have all the fields that are projected from the
SQL. This is especially possible in SQL statements like
       insert into kafka.outputTopic select id, company from profile
where company is an avro record in itself whose schema can evolve. When this happens we will end up with
fields in the SamzaSQLRelRecord for company field which doesn't have equivalent fields in the outputTopic's schema
for company. To support this scenario where the input schemas and output schemas can evolve in their own cadence,
We ignore the fields which doesn't have corresponding schema in the output topic.
samza-sql/src/main/java/org/apache/samza/sql/avro/AvroRelConverter.java