avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang <teddyyyy...@gmail.com>
Subject Re: how to utilize default?
Date Thu, 28 Jul 2011 20:30:31 GMT
thanks Doug and James!
On Jul 28, 2011 1:27 PM, "James Baldassari" <jbaldassari@gmail.com> wrote:
> 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.
>
> -James
>
>
> On Thu, Jul 28, 2011 at 4:20 PM, Doug Cutting <cutting@apache.org> 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
>>

Mime
View raw message