[
https://issues.apache.org/jira/browse/AVRO-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894593#action_12894593
]
Doug Cutting commented on AVRO-583:
-----------------------------------
> The problem I have with those error messages is that "map" is the name of a
> defined type.
The problem in part is that terms like "type", "name" and "defined" are
overloaded here. "map" is a keyword, like "type", and cannot alone be used to
determine the type of a field. The type of a field can either be a JSON
string, naming a previously defined type, or a JSON object.
> My deeper question is why this doesn't work? Is there a real problem naming
> and defining a map/array without nesting?
So you propose that, in addition to permitting nested type expressions we
permit flattened type expressions in fields. That's possible. How would
metadata be handled? For example, if someone put "foo":"bar" in a field, would
that be a property of the Field, of its Schema, or both? Worse yet, how about:
{"name": "myfield", "type": "record", "name": "myrecord", "fields":[...] }
Oops. That has two names! JSON objects are unordered, so we can't tell them
apart!
> 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
> Components: java
> 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.