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

Switch to Threaded View
Avro, mail # user - Setting field default value's programmatically


Copy link to this message
-
Re: Setting field default value's programmatically
Lewis John Mcgibbney 2013-10-27, 18:48
Hi Doug,
Thanks for reading and for reply.

On Sun, Oct 27, 2013 at 5:25 PM, Doug Cutting <[EMAIL PROTECTED]> wrote:

> That said,
> one could define an alternate method that returns a type-specific
> default value when none is specified.
This is more like what I had in mind. Until I discussed this with another
Gora committer and saw the rest of your reply I was not sure if this should
be addressed on the Gora-side or if it is something we can work on for
Avro.
> Alternately, one could traverse
> schemas and populate fields that have no specified default with a
> type-specific default.  I haven't looked at the Gora code in question,
> but perhaps there's an opportunity to pre-process the schemas there,
> prior to Avro code generation?
>
>
This sounds sensible and much more in fit with what we are after. This was
more or less what we were trying to achieve by setting the default value to
null (within the compiler) on a field-by-field basis if no default value
was explicitly specified within the Avro schema. I think we'll progress on
this basis.

Thanks for the thoughts.
Lewis