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

Christophe Le Saec commented on AVRO-3130:
------------------------------------------

Hello [~honoredb],

it does work with
{code:json}
{
  "type" : "record",
  "name" : "AccountEvent",
  "fields" : [ 
    {
      "name" : "NullableLongArray",
      "type" : [ 
           "null",
           { "type":"array", "items":"long" } 
       ]
    } 
  ]
}
{code}

Maybe i missed something, but i don't see the purpose of 'accountList' name 
(_As it's not a field_)

> Schema.java errors with "No type" when a type object is provided instead of 
> text type
> -------------------------------------------------------------------------------------
>
>                 Key: AVRO-3130
>                 URL: https://issues.apache.org/jira/browse/AVRO-3130
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Aaron Zinger
>            Priority: Minor
>
> When a schema object is provided inside a union or as an array items type, 
> the parser looks for a text value for type, doesn't find it, and throws a 
> confusing error message of the form "No type: <thing with a type>".
> The error message could be fixed by having GetRequiredText distinguish 
> between the key not being present and the value not being text, with the 
> latter returning a message like "Value for type must be string".
> However, my preferred change would be to handle schema objects in these 
> situations--it seems like it'd be compliant with the spec to have {"type": 
> "string"} resolve to "string", and it would let schema generation code be a 
> little simpler by letting it reuse schemas. This could also address 
> https://issues.apache.org/jira/browse/AVRO-1977, I think.
> Examples below.
> {code:json}
> {
>     "type": "record",
>     "name": "AccountEvent",
>     "fields": [
>         {"type": 
>           ["null",
>            { "name": "accountList",
>               "type": {
>                 "type": "array",
>                 "items": "long"
>               }
>           }
>           ], 
>          "name":"NullableLongArray"
>        }
>     ]
> }
> {code}
> Fails with {code:java}"No type: 
> {\"name\":\"accountList\",\"type\":{\"type\":\"array\",\"items\":\"long\"}}"{code}
> The error is similar for
> {code:json}
> {
>     "type": "array",
>     "name": "FavoriteNumbers",
>     "items": {"type":{"type": ["null","long"], "name": "NullableNumber"}}
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to