You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Elliot West <te...@gmail.com> on 2020/07/14 12:53:55 UTC

Unions: default values

Forwards compatibility permits us to update the writer schema independently
of the consumer. In particular, with record types we are free to add fields
with no breaking changes with respect to the consumer - a record is an
extensible type.

Avro includes two additional extensible types: enum and union.

Until recently it was not possible to extend an enum with forwards
compatibility - adding a new symbol to a writer's enum would result in a
breaking change at the reader as it would not recognise the symbol. Avro
1.9.0 added the concept of a default value for enums - a symbol that the
reader should use if it encounters a symbol it does not recognise, and thus
it became possible to evolve enums in a manner that was forwards compatible.

However, this kind of functionality does not exist for unions and it is not
yet possible to add types to an enum in a similarly forward compatible
manner. Would it not make sense for unions to also support a default value?
Has there been any previous efforts to explore the possibility?

Thanks,

Elliot.