[
https://issues.apache.org/jira/browse/AVRO-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Pershyn updated AVRO-1564:
----------------------------------
Attachment: AVRO-1564-test.patch
> 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: Michael Pershyn
> Labels: easyfix
> Attachments: 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}
> And it 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.2#6252)