avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Builder pattern and default values in records
Date Wed, 15 Jun 2011 09:34:59 GMT

I don't know of anyone currently working on this.  It'd be great to have!


On 06/13/2011 08:37 PM, James Baldassari wrote:
> Hi,
> I was confused about why the Avro compiler wasn't initializing my
> record's member variables with the default values I specified in my
> IDL/schema, and then I came across this thread which explained the issue:
> http://search-hadoop.com/m/iDVTn1JVeSR1
> In the above thread Doug made this comment:
> "Factory/builders are probably the best approach at present.  Ideally we
> might generate accessor methods, track which fields have been set, and
> then set unset fields to their default values before writing."
> That sounds like a good approach, using mutators to track which fields
> have been set.  Records could also implement the builder pattern, which
> would make it much more convenient to construct records by chaining
> setter invocations.
> It looks like there has been some discussion of this in AVRO-726 and
> AVRO-770, but there hasn't been much activity lately.  Is anyone
> actively working on this?  If no one has the time, I would be glad to
> work on a patch.
> -James

View raw message