avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Baldassari <jbaldass...@gmail.com>
Subject Builder pattern and default values in records
Date Mon, 13 Jun 2011 18:37:39 GMT

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:


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

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


View raw message