You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sean Busbey (JIRA)" <ji...@apache.org> on 2014/08/12 22:16:12 UTC

[jira] [Commented] (AVRO-1566) Use field default value to fill in missing values when serializing records

    [ https://issues.apache.org/jira/browse/AVRO-1566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14094602#comment-14094602 ] 

Sean Busbey commented on AVRO-1566:
-----------------------------------

{noformat}
+      else:
+        self.write_data(field.type, None, encoder)
{noformat}

Worth a note that this maintains the behavior of allowing optional null fields that don't specify a default? (even though this was probably incorrect behavior, [our getting started guide mentions relying on this behavior|http://avro.apache.org/docs/1.7.7/gettingstartedpython.html#Serializing+and+deserializing+without+code+generation].)

Actually, looking at io.py did defaulting to None actually work or did it throw?

> Use field default value to fill in missing values when serializing records
> --------------------------------------------------------------------------
>
>                 Key: AVRO-1566
>                 URL: https://issues.apache.org/jira/browse/AVRO-1566
>             Project: Avro
>          Issue Type: Improvement
>          Components: python
>            Reporter: Jeno I. Hajdu
>            Priority: Minor
>         Attachments: AVRO-1566.patch
>
>
> Field default values according to the spec are meant to fill in fields present in the reader schema but missing from the writer schema during deserialization. In addition to that default values could be used in the writer schema to fill in missing values when serializing. This is already supported in the Java implementation through record builders.



--
This message was sent by Atlassian JIRA
(v6.2#6252)