On Tue, May 7, 2013 at 11:39 PM, Doug Cutting <[email protected]> wrote:
> On Tue, May 7, 2013 at 12:46 PM, Bernd Fondermann > <[email protected]> wrote: > > 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. > I'll give it a try. > > > 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? > > I see. - Thank you very much. Bernd
