You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Elliot West (Jira)" <ji...@apache.org> on 2020/07/15 12:56:00 UTC

[jira] [Created] (AVRO-2895) Use default to allow old readers to specify default union value when encountering new union branches

Elliot West created AVRO-2895:
---------------------------------

             Summary: 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


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.3.4#803005)