[
https://issues.apache.org/jira/browse/AVRO-2895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17491977#comment-17491977
]
Lukasz Sanek commented on AVRO-2895:
------------------------------------
This would be a great improvement. There was a discussion about this a while
ago on the mailing list
[https://lists.apache.org/thread/v35xo1mjgc4hkqf313crgwvngokb7frl]
[~mtth] and [[email protected]] suggested possible solutions
> Use default to allow old readers to specify default union value when
> encountering new union branches
> ----------------------------------------------------------------------------------------------------
>
> Key: AVRO-2895
> URL: https://issues.apache.org/jira/browse/AVRO-2895
> Project: Apache Avro
> Issue Type: Improvement
> Components: spec
> Reporter: Elliot West
> Priority: Minor
>
> The schema resolution page says:
> {quote}*if both are unions:*
> The first schema in the reader's union that matches the selected writer's
> union schema is recursively resolved against it. if none match, an error is
> signalled.
> {quote}
> This makes it difficult to use unions because you can never add a new type to
> a union and keep old reader's compatible. Can we not follow the approach
> provided by other Avro extensible types ({{record}}, {{enum}}) and use a
> default value so that when an old reader encounters a union branch it does
> not recognise, 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.
> Clearly, the provided default value must be valid with respect to one of the
> types declared in the reader's union schema.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)