You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/03/02 21:07:00 UTC

[jira] [Commented] (AVRO-2152) JsonDecoder fails when reading record with aliases inside union

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

ASF GitHub Bot commented on AVRO-2152:
--------------------------------------

phaas opened a new pull request #291: AVRO-2152: Fix JsonDecoder handling of aliases in unions.
URL: https://github.com/apache/avro/pull/291
 
 
    - Determine aliases of any named types when generating
      the json grammer
    - When reading union, check aliases when exact match is not found.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> JsonDecoder fails when reading record with aliases inside union
> ---------------------------------------------------------------
>
>                 Key: AVRO-2152
>                 URL: https://issues.apache.org/jira/browse/AVRO-2152
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.2
>         Environment: JDK 1.8
> Avro 1.8.2
>            Reporter: Patrick Haas
>            Priority: Major
>         Attachments: JsonDecoderAliasesInUnion.java
>
>
> The JsonDecoder only handles aliases at the "top level" or "field level". Aliased records within a union fail with an "Unknown union branch" AvroTypeException.
>  The same writer/read schema combination works fine with the binaryEncoder, and the two schemas are considered a COMPATIBLE by the SchemaCompatibility check.
>  
> h1. Writer Schema
> {
>  "type" : "record",
>  "name" : "WWrapper",
>  "namespace" : "writer.ns",
>  "doc" : "writer",
>  "fields" : [ {
>  "name" : "item",
>  "type" : [ "null", {
>  "type" : "record",
>  "name" : "WItem",
>  "doc" : "writer item",
>  "fields" : [ {
>  "name" : "value",
>  "type" : "string",
>  "doc" : "value"
>  } ]
>  } ],
>  "doc" : "value"
>  } ]
> }
> h1. Reader Schema
> {
>  "type" : "record",
>  "name" : "RWrapper",
>  "namespace" : "reader.ns",
>  "doc" : "reader",
>  "fields" : [ {
>  "name" : "item",
>  "type" : [ "null", {
>  "type" : "record",
>  "name" : "RItem",
>  "doc" : "reader item",
>  "fields" : [ {
>  "name" : "value",
>  "type" : "string",
>  "doc" : "value"
>  } ],
>  "aliases" : [ "writer.ns.WItem" ]
>  } ],
>  "doc" : "value"
>  } ],
>  "aliases" : [ "writer.ns.WWrapper" ]
> }



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