[ https://issues.apache.org/jira/browse/AVRO-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17853927#comment-17853927 ]
Oscar Westra van Holthe - Kind commented on AVRO-3988: ------------------------------------------------------ I like the idea of using aliases for enum symbols as well. Whether consolidating values is a good idea is something that is debatable, but I think a foregone conclusion: using an enum default already allows consolidating all (purposefully) omitted values into one. Also, semantically speaking, using an enum default or an alias to consolidate values is different: a default value is essentially a value for "unknown", whereas an alias carries another meaning. > Allow enum value aliasing > ------------------------- > > Key: AVRO-3988 > URL: https://issues.apache.org/jira/browse/AVRO-3988 > Project: Apache Avro > Issue Type: Improvement > Reporter: Omer van Kloeten > Priority: Minor > > When providing an enum in a schema, it's an incompatible change to rename any > of its values. However, Avro can offer compatibility using aliases. > Let's take the example from the docs: > { > "type": "enum", > "name": "Suit", > "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"] > } > I want to change the name "CLUBS" to "CLOVERS". I can do that using the > syntax: > { > {{ "type": "enum",}} > {{ "name": "Suit",}} > {{ "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLOVERS"],}} > {{ "aliases": {}} > {{ "CLOVERS": [ "CLUBS" ]}} > } > } > This change of name can be accommodated by the reader schema. > Another thing this opens up is the ability to consolidate values. For > instance, again based on the example schema (first one in this ticket): > { > {{ "type": "enum",}} > {{ "name": "Suit",}} > {{ "symbols" : ["SPADES", "HEARTS", "CLOVERS"],}} > {{ "aliases": {}} > {{{} "{}}}{{{}SPADES{}}}{{{}": [ "{}}}{{{}DIAMONDS{}}}{{{}" ]{}}} > } > {{}}} > The above says that any DIAMONDS should be converted by the reader schema to > SPADES. > > (sorry about the formatting, I just can't get it right for some reason) -- This message was sent by Atlassian Jira (v8.20.10#820010)