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

Zoltan Farkas commented on AVRO-1340:
-------------------------------------

FELIX> Can v1 have no "fallbackSymbol", v2 define "fallbackSymbol":"SPADES" and 
then v3 define "fallbackSymbol":"HEART"?

Z>Yes, In the case above if v2 adds a symbol that is not present in v1, a v2 
record will not be convertible to v1, but it will be the other way around. 
Having v2 and v3 with different fallback symbols would be fine with the logic 
that when converting records to v2 and v3 unknown symbols will be converted to 
different symbols...

The symbol aliases the way I described and implemented above allows only the 
renaming of a enum symbol in a backwards compatible matter. (A alias is just 
another name for the same thing like with field aliasses)
if you have enum symbol BADNAME you can rename it in v+1: CORRECT_NAME with 
symbolAliasses : "CORRECT_NAME" : ["BADNAME"]

a example of how this would work you can see at: 
https://github.com/zolyfarkas/avro/pull/3/files#diff-e7505abebad7702fa59c473f4e976b0fR41
 

FELIX>why not name "fallbackSymbol" as "default", to keep it inline with 
regular Avro syntax?

Z> This does not feel like a default value... currently default values apply 
only to fields... for we would declare a field as:
Enum field = "SPADE"
but fallbackSymbol would be "UNKNOWN".
I am not sure fallbackSymbol is the best name, I am open for any suggestions 
for: "symbol to use when we don't have a match". Default for me means "symbol 
to use when no symbol is provided"...

let me know if it makes sense....



> use default to allow old readers to specify default enum value when 
> encountering new enum symbols
> -------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-1340
>                 URL: https://issues.apache.org/jira/browse/AVRO-1340
>             Project: Avro
>          Issue Type: Improvement
>          Components: spec
>         Environment: N/A
>            Reporter: Jim Donofrio
>            Priority: Minor
>
> The schema resolution page says:
> > if both are enums:
> > if the writer's symbol is not present in the reader's enum, then an
> error is signalled.
> This makes it difficult to use enum's because you can never add a enum value 
> and keep old reader's compatible. Why not use the default option to refer to 
> one of enum values so that when a old reader encounters a enum ordinal it 
> does not recognize, it can default to the optional schema provided one. If 
> the old schema does not provide a default then the older reader can continue 
> to fail as it does today.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to