You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Doug Cutting (JIRA)" <ji...@apache.org> on 2010/06/23 01:15:50 UTC

[jira] Commented: (AVRO-583) Bad error message if you try and name an array or a map: org.apache.avro.SchemaParseException: Undefined name: "map"

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

Doug Cutting commented on AVRO-583:
-----------------------------------

The bug in that schema is that, when a string is used as a type it's assumed to be a type name.

I think the schema you intended is:

{code}
{
  "name":"annoyance",
  "type":"record",
  "fields":[
    {"name":"mymap", "type": {"type": "map", "values":"string"}}
  ]
}
{code}

That should parse.

Maybe we should prohibit the use of non-primitive type keywords as user type names,  e.g., "map", "record", "enum", "fixed", and "array" could be made reserved words.  That would permit us to generate a better error here.

> Bad error message if you try and name an array or a map: org.apache.avro.SchemaParseException: Undefined name: "map"
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-583
>                 URL: https://issues.apache.org/jira/browse/AVRO-583
>             Project: Avro
>          Issue Type: Bug
>    Affects Versions: 1.3.2
>            Reporter: Sam Pullara
>            Priority: Minor
>             Fix For: 1.4.0
>
>
> Error message should be something like "You can't name a map"
> Broken schema:
> {
>   "name":"annoyance",
>   "type":"record",
>   "fields":[
>     {
>       "name":"mymap",
>       "type":"map",
>       "values":"string"
>     }
>   ]
> }
> Error:
> org.apache.avro.SchemaParseException: Undefined name: "map"
> 	at org.apache.avro.Schema.parse(Schema.java:876)
> 	at org.apache.avro.Schema.parse(Schema.java:912)
> 	at org.apache.avro.Schema.parse(Schema.java:796)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.