avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Baldassari <jbaldass...@gmail.com>
Subject Re: Builder pattern and default values in records
Date Wed, 15 Jun 2011 15:06:00 GMT
Thanks Doug.  I think I'll have some time in the coming weeks to work on
it.  I guess I'll go ahead and create a new issue so that we can discuss the
design.

-James


On Wed, Jun 15, 2011 at 5:34 AM, Doug Cutting <cutting@apache.org> wrote:

> James,
>
> I don't know of anyone currently working on this.  It'd be great to have!
>
> Doug
>
> 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
> >
>

Mime
View raw message