Thanks Sean, that's exactly what I was looking for. I have opened AVRO-1566 to cover this for python, also attached the patch.
Regards, Jeno On Tue, Aug 12, 2014 at 3:51 PM, Sean Busbey <[email protected]> wrote: > If you use Record builders you will currently get this behavior in the java > implementation[1]. > > AFAICT, there's no builder equivalent in the python implementation yet. > > In python maybe we can skip having a builder because we can distinguish > between "key maps to None" from "Dict does not contain key". > > Does that sound reasonable? Care to file a ticket and maybe propose a > patch? > > > [1]: > > http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/data/RecordBuilder.html > > or more likely the generic implementation: > > > http://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/generic/GenericRecordBuilder.html > > or an example of the builder in generated specific code: > > http://avro.apache.org/docs/current/gettingstartedjava.html#Creating+Users > > > > On Mon, Aug 11, 2014 at 2:33 PM, Jeno I. Hajdu <[email protected]> > wrote: > > > Hi, > > > > my understanding of the field default values (based on the spec) is that > it > > is solely for filling in fields present in the reader schema, but missing > > in the writer schema, thus defaults only make sense in reader schemas. > > > > In addition to that couldn't defaults be used on the writer side (defined > > in the writer schema) to fill in fields with missing values? So if I > have a > > record schema with 100 fields, all having defaults, I could specify only > 5 > > field values for a record to be serialized and the Avro lib would fill in > > the rest. This does not impact the serialization (format) itself, the > spec > > would only allow using defaults for this purpose (and for example adding > > this support to the python implementation takes 2 extra lines based on a > > quick trial). > > > > What do you think? Would this go against Avro's philosophy? > > > > Thanks and Regards, > > Jeno > > > > > > -- > Sean >
