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

Switch to Threaded View
Avro >> mail # dev >> AVRO-1270 - implementation?

Copy link to this message
AVRO-1270 - implementation?
Doug - in the avro-users group you posted this :



>>Chris Laws:

>> I get:
>> Reading evolved data with schema resolution, showing new field "c"...
>> Error: Reader field c doesn't appear in writer
>> I was under the impression that I should have received the default
>> of 42 for field 'c' for each item in the data file.
>So this is actually because the C API doesn't support default values
>yet.  :-/  The schema parsing code just ignores the "default" clause
>completely, which is why you're seeing that particular error message.
>That said, we do have all of the pieces in place to handle default
>values now; they've just never been hooked together.  Could you open a
>JIRA ticket for this?  I think it's something that we could bang
>together pretty quickly.




I work with Chris Laws, and for our application we need to fix
AVRO-1270, to implement default values in the C API. I've looked at the
sources and understand most of it, but I could do with a few tips.  What
exactly are all the 'pieces' you're referring to handle default values?
I can see most of the TODO comments, but I'm a little lost on exactly
how to proceed.


I've looked at the Java API, and I noticed that they store the default
values as a JsonNode inside the Field.  At resolution time, the
GenericDatumReader converts it to Avro format (and caches it).  I don't
think I can do the same with the C bindings - is there a function to
convert a json_t  directly into the equivalent Avro type?


Any advice (or code) welcome :-)




Steve Roehrs