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

Doug Cutting commented on AVRO-207:
-----------------------------------

There's no ambiguity for enums, since the spec says that the first matching is 
always used.  With a union the restriction permits optimizations: by not 
allowing two arrays in a union, a writer using runtime types need only check 
whether an object is an array and does not have to check its elements, 
similarly for maps.  Also, semantics would get complex to specify without this 
restriction, e.g., if you have a union with two arrays each with union element 
types that might involve promotion, etc.  I don't recall all the details, but 
trying to implement things correctly without this restriction on unions proved 
very difficult.  But implementing enums correctly without prohibiting 
duplicates is easy.

That said, duplicates in enums will probably break specific implementations, 
since, e.g., Java's enum does not permit duplicates.

> python parser doesn't check for ambiguous unions/enums
> ------------------------------------------------------
>
>                 Key: AVRO-207
>                 URL: https://issues.apache.org/jira/browse/AVRO-207
>             Project: Avro
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 1.2.0
>            Reporter: Patrick Hunt
>            Assignee: Jeff Hammerbacher
>            Priority: Minor
>         Attachments: AVRO-207.patch
>
>
> The python parser doesn't flag these as ambiguous (java flags the union, but 
> not the enum)
>       "response": {"name":"E1", "type":"enum", "symbols":["AA", "AA"]},
>       "response": ["long","long"],

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

Reply via email to