avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcio Silva (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1204) Schema.createUnion can produce schemas that aren't parseable due to redefinition of types
Date Thu, 15 Nov 2012 03:10:12 GMT

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

Marcio Silva updated AVRO-1204:
-------------------------------

    Affects Version/s: 1.7.2
    
> Schema.createUnion can produce schemas that aren't parseable due to redefinition of types
> -----------------------------------------------------------------------------------------
>
>                 Key: AVRO-1204
>                 URL: https://issues.apache.org/jira/browse/AVRO-1204
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.2, 1.7.3
>            Reporter: Marcio Silva
>         Attachments: 0001-Creating-test-case-to-illustrate-Union-schema-proble.patch
>
>
> Schemas returned from {{Schema.createUnion}} aren't always re-parsable (after calling
Schema.toString()).
> If you create a union of types that contain multiple references to the same type, the
resulting {{Schema}} instance returned can't be written to JSON and then re-parsed due to
a SchemaParseException on type redefinition.
> The fix probably involves changes to {{UnionSchema.toJson}} to ensure that any repeated
type definitions are replaced by a named reference.
> For a concrete example, the union of the following two schemas is problematic:
> {code:javascript|title=child-schema.avsc}
> {"type":"record",
>  "name":"UnionTestChild",
>  "namespace":"org.apache.avro",
>  "fields":[
>                { "name":"intField","type":"int"},
>                { "name":"stringField", "type":"string"}
>            ]
> }
> {code}
> {code:javascript|title=parent-schema.avsc}
> {
>    "type":"record",
>    "name":"UnionTestParent",
>    "namespace":"org.apache.avro",
>    "fields":[
>       {
>          "name":"child",
>          "type":{
>             "type":"record",
>             "name":"UnionTestChild",
>             "namespace":"org.apache.avro",
>             "fields":[
>                { "name":"intField","type":"int"},
>                { "name":"stringField", "type":"string"}
>             ]
>          }
>       }
>    ]
> }
> {code}

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