You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Divya (Jira)" <ji...@apache.org> on 2021/03/08 14:26:00 UTC

[jira] [Comment Edited] (AVRO-3064) Issue: Unknown union branch fixed

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

Divya edited comment on AVRO-3064 at 3/8/21, 2:25 PM:
------------------------------------------------------

Thank you for your response [~scottbelden].

 

Yes, it is part of the whole Schema.

 

The schema looks like this:

 

{
   *"type"*: *"record"*,
   *"name"*: *"some name"*,
   *"fields"*: [
        {
       *"name"* : *"exacAmt"*,
       *"type"* : [ *"null**"*,

{  "type" : "fixed",  "name" : "exacAmt",   "size" : 16,  "logicalType" : "decimal",  "precision" : 38,  "scale" : 18       }

],
       *"default"* : *null*
     }  ]
 }

 

The output we are expecting is:

 "exacAmt": 3747022.522500000000000000  *or* "exacAmt":null

 

What should we do to make the JSON work?


was (Author: divyasetia):
Thank you for your response [~scottbelden].

 

Yes, it is part of the whole Schema.

 

The schema looks like this:

 

{
  *"type"*: *"record"*,
  *"name"*: *"some name"*,
  *"fields"*: [
       {
      *"name"* : *"exacAmt"*,
      *"type"* : [ *"null**"*, {  *"type"* : *"fixed"*,  *"name"* : *"exacAmt"*,   *"size"* : 16,  *"logicalType"* : *"decimal"*,  *"precision"* : 38,  *"scale"* : 18
      } ],
      *"default"* : *null*
    **    }  ]
}

 

The output we are expecting is:

 "exacAmt": 3747022.522500000000000000  *or* "exacAmt":null

 

What should we do to make the JSON work?

> Issue: Unknown union branch fixed
> ---------------------------------
>
>                 Key: AVRO-3064
>                 URL: https://issues.apache.org/jira/browse/AVRO-3064
>             Project: Apache Avro
>          Issue Type: Task
>          Components: java
>    Affects Versions: 1.8.0
>            Reporter: Divya
>            Priority: Major
>         Attachments: Screenshot from 2021-03-04 21-19-06.png
>
>
> Hello,
>  
> We are looking for documentation on how a fixed value can be used with null.
> We are using avro-1.8.0 and trying to generate a Decimal value with the help of JSONDecoder for schema:
>         {
>             "name": "exacAmt",
>             "type": [
>                 {
>                     "type": "fixed",
>                     "name": "exacAmt",
>                     "size": 16,
>                     "logicalType": "decimal",
>                     "precision": 38,
>                     "scale": 2
>                 },
>                 "null"
>             ]
>         }
> But we are getting an exception:
> _Message: Unknown union branch fixed_
>  _Line | Method_
>  _->> 445 | readIndex in org.apache.avro.io.JsonDecoder_
>  
> Please advise how can this issue be resolved.
> !Screenshot from 2021-03-04 21-19-06.png!
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)