Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1564

Unknown datum type exception while converting optional bytes using avro-thrift

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.7
    • 1.8.0
    • java

    Description

      Very similar to AVRO-1500.

      When in thrift schema (e.g. Test) with optional byte field:

      16: optional byte byteOptionalField
      

      This field is initialized like:

      test.setByteOptionalField((byte)4);
      

      Then during conversion of this thrift-object to avro instead of converting it to int 4, the exception is thrown.

      org.apache.avro.AvroRuntimeException: Unknown datum type java.lang.Byte: 4                                                                                                                                                                     
              at org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:637)                                                                                                                                                             
              at org.apache.avro.thrift.ThriftData.getSchemaName(ThriftData.java:120)                                                                                                                                                                
              at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:602)                                                                                                                                                              
              at org.apache.avro.generic.GenericDatumWriter.resolveUnion(GenericDatumWriter.java:151)                                                                                                                                                
              at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:71)                                                                                                                                                        
              at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:114) 
      

      Proposed solution is also similar to AVRO-1500 - to overload getSchemaName in org.apache.avro.thrift.ThriftData

      Attachments

        1. AVRO-1564-fix.patch
          0.9 kB
          Michael Pershyn
        2. AVRO-1564-test.patch
          11 kB
          Michael Pershyn

        Activity

          People

            pershyn Michael Pershyn
            pershyn Michael Pershyn
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: