avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Overmeyer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1817) Allow enums to be "promoted" to strings
Date Thu, 31 Mar 2016 14:50:25 GMT

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

Michael Overmeyer commented on AVRO-1817:

[~busbey]: I could give it a shot, but unfortunately I won't have time to work on it for a
few weeks.
If anyone else wants to take a stab at it in the mean time, they should feel free to do so.

> Allow enums to be "promoted" to strings
> ---------------------------------------
>                 Key: AVRO-1817
>                 URL: https://issues.apache.org/jira/browse/AVRO-1817
>             Project: Avro
>          Issue Type: Improvement
>          Components: java, spec
>            Reporter: Michael Overmeyer
>            Priority: Minor
> We should consider adding a resolution rule that can promote an enum to a string using
the enum's symbol.
> I have an Avro schema that has a field with an enum type. However, I have realized that
an enum is not the type I actually wanted. I would much rather have the type of the field
be a string. I went to change this, but of course this type of change (enum -> string)
is not within the bounds of Avro's schema evolution. Therefore a reader with this changed
schema is not be able to read an object written with the old schema.
> For example, if the writer schema was:
> enum Colour {
> }
> protocol stoplight {
>   Colour colour;
> }
> And the reader schema was:
> protocol stoplight {
>   string colour;
> }
> Then when you access the colour field of your object, you get the string representation
of the enum value's symbol .
> For example, Colour.RED => "RED", Colour.YELLOW => "YELLOW", Colour.GREEN =>

This message was sent by Atlassian JIRA

View raw message