You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org> on 2018/12/30 05:36:00 UTC

[jira] [Updated] (AVRO-1714) Nullable Named Schema definition in IDL fails.

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

Thiruvalluvan M. G. updated AVRO-1714:
--------------------------------------
    Component/s: java

> Nullable Named Schema definition in IDL fails.
> ----------------------------------------------
>
>                 Key: AVRO-1714
>                 URL: https://issues.apache.org/jira/browse/AVRO-1714
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.6
>            Reporter: Mark Perris
>            Priority: Major
>
> According to Section 7.2 of the Avro IDL, named schemata may be treated as primitive types.
> As such, I believe it should be possible to create a nullable schema reference:
> {code}
>    record coordinate {
>       string type;
>    }
>    record tweet {
>       union {null, coordinate} coordinate;
>    }
> {code}
> to accommodate
> {code}
> {  
>    "coordinate":{  
>       "type":"point"
>    }
> }
> {code} and {code}
> {  
>    "coordinate":null
> }
> {code}
> however, any attempt to store data against that schema results in
> {code}
> Exception in thread "main" org.apache.avro.AvroTypeException: Unknown union branch type
> 	at org.apache.avro.io.JsonDecoder.readIndex(JsonDecoder.java:445)
> 	at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:290)
> 	at org.apache.avro.io.parsing.Parser.advance(Parser.java:88)
> 	at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:267)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:155)
> 	at org.apache.avro.generic.GenericDatumReader.readField(GenericDatumReader.java:193)
> 	at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:183)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:151)
> 	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:142)
> 	at org.apache.avro.tool.DataFileWriteTool.run(DataFileWriteTool.java:99)
> 	at org.apache.avro.tool.Main.run(Main.java:85)
> 	at org.apache.avro.tool.Main.main(Main.java:74)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)