You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Michael Pershyn (JIRA)" <ji...@apache.org> on 2014/11/26 15:38:13 UTC

[jira] [Commented] (AVRO-1564) Unknown datum type exception while converting optional bytes using avro-thrift

    [ https://issues.apache.org/jira/browse/AVRO-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14226260#comment-14226260 ] 

Michael Pershyn commented on AVRO-1564:
---------------------------------------

I am using patched version already 4 month and really happy with the fix, however would like to see it in upstream, so I can then easily update to new versions of avro and try them out without extra step of applying a 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: 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)