|
|
+
Jon Bender 2012-06-05, 04:00
-
Re: Duplicate field names inside nested recordsDoug Cutting 2012-06-06, 17:36
On 06/04/2012 09:00 PM, Jon Bender wrote:
> At the moment I'm trying to use the following Avro schema: > http://pastebin.com/SXKZ0KAR > > When I try to parse the schema, it's throwing an error because of the > duplicate record name "configData" (Error: can't redefine: "configData") > contained in multiple different records. As you can see these names are > nested inside of other fields/records, so I wasn't expecting there to be > a collision of the record names defined at different levels. Record names are not defined in a nested, lexical scope, but rather dynamically during the parsing. Once a name is defined it persists through the rest of parsing process. This permits one to define a record the first time it's used, then refer to it by name in subsequent uses. > I am constructing this overall Avro schema from a number of smaller > schemas ("FOO", "BAR" being examples) which are map types and need to be > nullable, which is why I tried to define them as union ["null", {type: > map }]. > > Is there any way to preserve the original names of the records (eg. > configData) in this particular design, or do I need to redefine the > record names of each individual object to avoid collisions? It's not entirely clear to me what you're trying to model, but Avro won't let you use the same record namespace+name for two different things within a single schema. Sorry! Doug |