avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Douglas Creager (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-656) writing unions with multiple records, fixed or enums can choose wrong branch
Date Wed, 05 Jan 2011 19:53:46 GMT

    [ https://issues.apache.org/jira/browse/AVRO-656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977937#action_12977937

Douglas Creager commented on AVRO-656:

You could make the union wrapper optional in the dynamic languages.  So when writing out a
union schema value, if you get a union wrapper data instance, then great, that's used to choose
the branch.  If not, it uses the previous rules, with the caveat that there might a run-time
error if the schema is ambiguous.  For most people, who have unambiguous schemas, they don't
need to jump through the extra hoops.  But if you do have an ambiguous schema, you have a
way to resolve the ambiguity.

That could work as an alternative solution on the Java side, too, if you want to avoid breaking
API compatibility.

> 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.

View raw message