Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # dev >> Reading nested specific type

Copy link to this message
Re: Reading nested specific type
On Tue, May 7, 2013 at 12:46 PM, Bernd Fondermann
> Thanks, the bug is fixed if I don't use a union.

I found the problem with unions & updated the patch for AVRO-1320 to
fix this too.  Please let me know if that solves things for you.

> However, if there are two enums in a union, could the deserialization
> possibly work? How would Avro know which one was serialized?

The position of the schema in the union is written preceding the
value.  So a union of ["null","string"] is written as either a zero
alone or a one followed by a string.  Similarly, enum symbols are
written as their position in their schema.  For example, with the
following two enum schemas:

{"name":"X", "type", "enum", "symbols":["A","B","C"]}
{"name":"Y", "type", "enum", "symbols":["A","C","E"]}

Then the union schema ["X","Y"], an "A" from the first would be
written as zero zero, while the "A" from the second would be one zero.

Does that answer your question?