On Sat, Oct 26, 2013 at 3:41 AM, Lewis John Mcgibbney <[email protected]> wrote: > 2) Why org.apache.avro.data.RecordBuilderBase#defaultValue(Field field) is > not returning null if no default is specified in the schema... which is the > case?
It returns null when null is the default value, but throws an error when no default value is specified. This is required for correct behavior, since null values are invalid for many types. That said, one could define an alternate method that returns a type-specific default value when none is specified. 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? Cheers, Doug
