avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Carey (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1274) Add a schema builder API
Date Thu, 02 May 2013 02:11:13 GMT

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

Scott Carey commented on AVRO-1274:

We may have more work to do here. 

How would you use the builder to do the equivalent of:

  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(


I am trying to suggest that we replace literal strings with the builder in AVRO-1316 but cannot
seem to repliate the above with the builder.

The "clientProtocol" and "meta" fields are the problem.  It does not seem possible to create
a union of null and 'more' without a default.

Additionally, "unionType" is confusing.  Is this how it would be done?  If so, I do not see
how to add types to the union if I start with:

unionType("clientProtocol", SchemaBuilder.NULL)
Then how do I add extra types?  Or is the type passed in expected to _be_ a union?  if so
the field should be named unionSchema and the javadoc needs to be clear.

This builder API makes it hard to create union fields without defaults.  Perhaps it is simply
a documentation issue and the doc for unionType() needs an example.  

Should we open a new ticket for these concerns or re-open this one?  I suspect it is largely
documentation but am not sure.
> 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
>             Fix For: 1.7.5
>         Attachments: AVRO-1274.patch, AVRO-1274.patch, AVRO-1274.patch, 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

View raw message