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

Doug Cutting commented on AVRO-1340:
------------------------------------

[~zolyfarkas], couldn't one specify (type1, type2, unknown) with default of 
unknown regardless of whether the default is in the field or in the enum 
definition itself?  Also, enums already support the default field value, in the 
case that the writer didn't have the enum field at all.  The proposal is simply 
to extend it to the case where the writer's symbol didn't match any in the 
reader's enum.  Do these cases need to be distinguished?

The advantage I see to adding the default to the enum's schema definition is 
that it better localizes things: the default lives with the enum rather than 
with every use of it.  Perhaps that's your point.  In this case, I prefer it be 
called "default" rather than "fallback" since it's conceptually similar to a 
field's default (both are used when the writer's missing something from the 
reader's schema).

Lastly, if we define it in the enum, then we need to decide how it interacts 
with the field's default value.  My intuition is that the field's default 
should override the enum's default.

> 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
(v7.6.3#76005)

Reply via email to