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 2011/01/05 01:10:47 UTC

[jira] Updated: (AVRO-656) writing unions with multiple records, fixed or enums can choose wrong branch

     [ https://issues.apache.org/jira/browse/AVRO-656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-656:
------------------------------

    Attachment: AVRO-656.patch

Here's a patch that implements the first option I proposed, way back when.  In particular:
  - the spec is altered so that only a single enum or fixed is permitted in a union.  (No implementation correctly supports multiple instances of these types in a union anyway.)
 - the java implementation and tests are updated to conform
 - java is also fixed so that 
  -- union dispatch among records correctly considers the namespace
  -- type names rendered in JSON unions now include the namespace



> writing unions with multiple records, fixed or enums can choose wrong branch 
> -----------------------------------------------------------------------------
>
>                 Key: AVRO-656
>                 URL: https://issues.apache.org/jira/browse/AVRO-656
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.4.0
>            Reporter: Doug Cutting
>            Assignee: Doug Cutting
>             Fix For: 1.5.0
>
>         Attachments: AVRO-656.patch, AVRO-656.patch
>
>
> According to the specification, a union may contain multiple instances of a named type, provided they have different names.  There are several bugs in the Java implementation of this when writing data:
>  - for record, only the short-name of the record is checked, so the branch for a record of the same name in a different namespace may be used by mistake
>  - for enum and fixed, the name of the record is not checked, so the first enum or fixed in the union will always be assumed when writing.  in many cases this may cause the wrong data to be written, potentially corrupting output.
> This is not a regression.  This has never been implemented correctly by Java.  Python and Ruby never check names, but rather perform a full, recursive validation of content.

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