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

Switch to Plain View
Avro >> mail # dev >> Schema Resolution for Enums


+
Youssef Hatem 2013-09-26, 12:57
+
graham sanderson 2013-09-26, 13:11
+
Youssef Hatem 2013-09-26, 13:29
+
graham sanderson 2013-09-26, 14:23
+
Doug Cutting 2013-09-27, 19:02
Copy link to this message
-
Re: Schema Resolution for Enums
It makes perfect sense, thanks a lot Doug.

Youssef

On Sep 27, 2013, at 21:02 , Doug Cutting wrote:

> On Thu, Sep 26, 2013 at 6:29 AM, Youssef Hatem
> <[EMAIL PROTECTED]> wrote:
>> All I can say is that we use the deserialized enum value as it is. So we get zero, which is wrong since zero corresponds to something else in the reader enum.
>
> You need to translate enum values from the writer's to the reader's
> schema.  This is not difficult, since both are present when you're
> reading.  An array can be created that maps each value written into
> the corresponding value in the reader's schema.  In your example this
> would be [1,0,2,3], so that when you read a zero you return a 1.
>
> Doug