avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Carey <scottca...@apache.org>
Subject Re: Does extending union break compatibility
Date Fri, 04 Nov 2011 01:00:09 GMT

On 11/3/11 4:56 PM, "Neil Davudo" <neil_davudo@yahoo.com> wrote:

>I have a record defined as follows
>// version 1
>record SomeRecord
>    union { null, TypeA } unionOfTypes;
>I change the record to the following
>// version 2
>record SomeRecord
>    union { null, TypeA, TypeB } unionOfTypes;
>Does the change break compatibility? Would data encoded using version 1
>of the record definition be decodable using version 2 of the record

Readers with the second schema should be able to read data written with
the first schema, provided they use the API properly (both schemas must be
provided to the reader, so that it can translate from one to the other).

The reverse, reading data written in the latter schema with the first
schema, is possible as well provided that the first schema contains a
default value so that if the reader encounters a union branch it does not
know about, it can substitute the default value.


View raw message