[ 
https://issues.apache.org/jira/browse/AVRO-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tom White updated AVRO-1274:
----------------------------

    Attachment: TestDefaults.patch

Thanks for the explanations, Doug. I'm still struggling to see when defaults 
kick in though (see attached test). E.g. at write time if I have a field

{"name":"f1", "type":["string", "int"], "default":"cat"}

and I don't set f1, then the write fails, complaining that f1 has not been set 
(even though there's a default).

Similarly, if I write a null field, then read it back using

{"name":"f1", "type":["string", "null"], "default":"cat"}

for the reader schema the read returns f1 as null, perhaps unsurprisingly, 
since it was written as a null.

If I use the first field schema (union of string and int), then the read fails 
with "Not in union ["string","int"]: null".

How are defaults meant to be used (this is with generic readers/writers)?
                
> Add a schema builder API
> ------------------------
>
>                 Key: AVRO-1274
>                 URL: https://issues.apache.org/jira/browse/AVRO-1274
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>            Reporter: Tom White
>            Assignee: Tom White
>         Attachments: AVRO-1274.patch, AVRO-1274.patch, AVRO-1274.patch, 
> TestDefaults.patch
>
>
> It would be nice to have a fluent API that made it easier to construct record 
> schemas.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to