avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bernd.fonderm...@gmail.com>
Subject Re: Reading nested specific type
Date Wed, 08 May 2013 05:34:41 GMT
On Tue, May 7, 2013 at 11:39 PM, Doug Cutting <cutting@apache.org> wrote:

> On Tue, May 7, 2013 at 12:46 PM, Bernd Fondermann
> <bernd.fondermann@gmail.com> 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message