[ https://issues.apache.org/jira/browse/AVRO-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14226674#comment-14226674 ]
ASF subversion and git services commented on AVRO-1564: ------------------------------------------------------- Commit 1641892 from [~cutting] in branch 'avro/trunk' [ https://svn.apache.org/r1641892 ] AVRO-1564. Java: Fix handling of optional byte field in Thrift. Contributed by Michael Pershyn. > Unknown datum type exception while converting optional bytes using avro-thrift > ------------------------------------------------------------------------------ > > Key: AVRO-1564 > URL: https://issues.apache.org/jira/browse/AVRO-1564 > Project: Avro > Issue Type: Bug > Components: java > Affects Versions: 1.7.7 > Reporter: Michael Pershyn > Assignee: Doug Cutting > Labels: easyfix > Attachments: AVRO-1564-fix.patch, AVRO-1564-test.patch > > > Very similar to AVRO-1500. > When in thrift schema (e.g. {{Test}}) with optional byte field: > {code} > 16: optional byte byteOptionalField > {code} > This field is initialized like: > {code} > test.setByteOptionalField((byte)4); > {code} > Then during conversion of this thrift-object to avro instead of converting it > to int 4, the exception is thrown. > {code} > 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) > > {code} > ---- > Proposed solution is also similar to AVRO-1500 - to overload > {{getSchemaName}} in {{org.apache.avro.thrift.ThriftData}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)