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

Tom White commented on AVRO-1325:
---------------------------------

Scott, thanks for all the effort you've put into this!

The major difference between this and AVRO-1274 is that there are now more 
method calls. One of the design points of AVRO-1274 was that you would specify 
all the required arguments in one method call. For example, 
{{SchemaBuilder.fixedType("myfixed", 16).build()}} has become 
{{SchemaBuilder.fixed("myfixed").size(16)}}. For the {{fixed}} example that is 
not really an issue, but it does become more cumbersome when building records, 
due to the requiredX/optionalX shortcuts in AVRO-1274:

|| AVRO-1274 field syntax || AVRO-1325 field syntax || JSON field syntax ||
| .requiredInt("f0") | .name("f0").type().intType().noDefault() | { "name" : 
"f0", "type" : "int" } |
| .optionalInt("f0") | .name("f0").type().optional().intType() | { "name" : 
"f0", "type" : [ "null", "int" ], "default" : null } |
| .optionalInt("f0", 1) | .name("f0").type().nullable().intType().intDefault(1) 
| { "name" : "f0", "type" : [ "int", "null" ], "default" : 1 } |

This JIRA is more faithful to the JSON, which I can see the value of. However, 
there's a tension between full generality and ease of use, so I'm thinking that 
it might be useful to have a RecordSchemaBuilder which is more like [Josh's 
original|https://issues.apache.org/jira/browse/AVRO-1274?focusedCommentId=13600838&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13600838],
 which is dedicated to building simple record schemas (without properties and 
other advanced features) using the required/optional language for fields. If 
there's interest in this we could add that separately. Thoughts?

Other comments
* The documentation is excellent.
* Why have type() and type(Schema)? The latter doesn't seem to add anything 
(it's used in one test, but that's not the point of the test), and indeed is 
potentially confusing, so could it be removed?
* Error type is missing, but this can be easily added.
                
> Enhanced Schema Builder API
> ---------------------------
>
>                 Key: AVRO-1325
>                 URL: https://issues.apache.org/jira/browse/AVRO-1325
>             Project: Avro
>          Issue Type: Bug
>            Reporter: Scott Carey
>            Assignee: Scott Carey
>             Fix For: 1.7.5
>
>         Attachments: AVRO-1325.patch, AVRO-1325-preliminary.patch, 
> AVRO-1325-properties.patch, AVRO-1325-v2.patch
>
>
> The schema builder from AVRO-1274 has a few key limitations.  I have proposed 
> changes to make before it is released and the public API is locked in.

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