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

Doug Cutting commented on AVRO-1274:
------------------------------------

> I'm wondering if the correct way to do this is actually to have [null, T] for 
> optional fields with no default [ ... ] and and [T, null] when there is a 
> non-null default.

The latter is certainly required when there is a non-null default.

The former is subtly different.  A reader with a [null, T] union with no 
default value specified still requires that the field be present in the 
writer's schema.  So it's a required nullable field as opposed to an entirely 
optional field.  This subtlety is confusing, so glossing over it in the builder 
API by always generating a default value of null for nullable fields with no 
other default value specified is probably best.

                
> 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, 
> 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