You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Daniel Blazevski (Jira)" <ji...@apache.org> on 2020/03/13 16:51:00 UTC

[jira] [Commented] (AVRO-1810) GenericDatumWriter broken with Enum

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

Daniel Blazevski commented on AVRO-1810:
----------------------------------------

Would it be possible to have a backport release of this in 1.8x?  I would rather not have to upgrade to 1.9x just for this since I may have to pull in jars compiled w/ 1.8 in the project. 

> GenericDatumWriter broken with Enum
> -----------------------------------
>
>                 Key: AVRO-1810
>                 URL: https://issues.apache.org/jira/browse/AVRO-1810
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.0
>            Reporter: Ryon Day
>            Assignee: Fokko Driesprong
>            Priority: Blocker
>             Fix For: 1.9.0
>
>
> {panel:title=Description|titleBGColor=#3FA|bgColor=#DDD}
> Using the GenericDatumWriter with either Generic OR SpecificRecord will break if an Enum is present.
> {panel}
> {panel:title=Steps To Reproduce|titleBGColor=#8DB|bgColor=#DDD}
> I have been tracking Avro decoding oddities for a while.
> The tests for this issue can be found [here|https://github.com/ryonday/avroDecodingHelp/blob/master/src/test/java/com/ryonday/test/Avro180EnumFail.java]
> {panel}
> {panel:title=Notes|titleBGColor=#3AF|bgColor=#DDD}
> Due to the debacle that is the Avro "UTF8" object, we have been avoiding it by using the following scheme:
> * Write incoming records to a byte array using the GenericDatumWriter
> * Read back the byte array to our compiled Java domain objects using a SpecificDatumWriter
> This worked great with Avro 1.7.7, and this is a binary-incompatable breaking change with 1.8.0.
> This would appear to be caused by an addition in the {{GenericDatumWriter:163-164}}:
> {code}
>   if (!data.isEnum(datum))
>       throw new AvroTypeException("Not an enum: "+datum);
> {code}
> {panel}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)