You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Neil Davudo <ne...@yahoo.com> on 2011/11/04 00:56:28 UTC
Does extending union break compatibility
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 definition?
TIA
Neil
Re: Does extending union break compatibility
Posted by Scott Carey <sc...@apache.org>.
On 11/3/11 4:56 PM, "Neil Davudo" <ne...@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
>definition?
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.
>
>TIA
>
>Neil