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

Switch to Threaded View
Avro >> mail # user >> how to utilize default?

Copy link to this message
Re: how to utilize default?
See also AVRO-839, which I think would give you the behavior you're looking
for.  I'm hoping to have time to finish up that patch in the next few weeks,
if things ever slow down at work for long enough.

On Thu, Jul 28, 2011 at 4:20 PM, Doug Cutting <[EMAIL PROTECTED]> wrote:

> On 07/28/2011 12:25 PM, Yang wrote:
> > but I guess I can't simply access a record field by
> >
> > my_record_obj.my_field_name
> >
> > and hope to get the default value , right? but then how can the
> > default value be obtained?
> Default values are used when reading a different version of the record
> that does not contain the field.  So if you add a new integer field
> whose default value is -1, then read a record written before that field
> was added, the old record will contain -1 as the value for the new
> field.  Implementations might also use the default value to initialize
> values when creating new record data structures, but that's not required.
> Doug