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-1325) Enhanced Schema Builder API
Date Wed, 15 May 2013 20:33:17 GMT

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

Scott Carey commented on AVRO-1325:
-----------------------------------

My most recent patch deals with the annoying 'everything has a property' case as follows:
{code}
Schema schema = SchemaBuilder.record("Rec").prop("recProp", "r").fields()
  .name("locations").prop("fieldProp", "f").map().prop("mapProp","m").values()
    .stringBuilder().prop("valProp","v").endString()
  .endRecord()
{code}

The example from the first comment, based on the schema in the Avro spec page:
{code}
Schema schema = SchemaBuilder.record("HandshakeRequest").namespace("org.apache.avro.ipc").fields()
  .name("clientHash").type().fixed("MD5").size(16).noDefault() // namespace is inherited
  .name("clientProtocol").type().nullable().stringBuilder()  // nullable() is union of type
and null
    .prop("avro.java.string", "String").endString().noDefault()
  .name("serverHash").type("MD5").noDefault()  //reference by name
  .name("meta").type().optional().map().prop("avro.java.string", "String").values().bytesType()
// optional is union of null and type with null default
  .endRecord();
{code}

                
> 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

Mime
View raw message