You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Xiaolu Ye (JIRA)" <ji...@apache.org> on 2010/12/30 17:36:47 UTC

[jira] Commented: (AVRO-695) Cycle Reference Support

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

Xiaolu Ye commented on AVRO-695:
--------------------------------

Moustapha,

Our project need cycle reference support. Thanks for submitting the patch. When trying to use it, I noticed a bug in GenericData.Array. It needs to override AbstractList.set(int, T) as below section of GenericDatumReader.interpretCycles() uses set call. Currently, it throws UnsupportedOperationException at line 175

            if (record instanceof List) {
              ((List) record).set(Integer.parseInt(field), result); // line 175
            } else {
              Array.set(record, Integer.parseInt(field), result);
            }

Thanks,

Xiaolu

> Cycle Reference Support
> -----------------------
>
>                 Key: AVRO-695
>                 URL: https://issues.apache.org/jira/browse/AVRO-695
>             Project: Avro
>          Issue Type: New Feature
>          Components: spec
>    Affects Versions: 1.4.1
>            Reporter: Moustapha Cherri
>             Fix For: 1.5.0
>
>         Attachments: avro-1.4.1-cycle.patch.gz
>
>   Original Estimate: 672h
>  Remaining Estimate: 672h
>
> This is a proposed implementation to add cycle reference support to Avro. It basically introduce a new type named Cycle. Cycles contains a string representing the path to the other reference.
> For example if we have an object of type Message that have a member named previous with type Message too. If we have have this hierarchy:
> message
>   previous : message2
> message2
>   previous : message2
> When serializing the cycle path for "message2.previous" will be "previous".
> The implementation depend on ANTLR to evaluate those cycle at read time to resolve them. I used ANTLR 3.2. This dependency is not mandated; I just used ANTLR to speed thing up. I kept in this implementation the generated code from ANTLR though this should not be the case as this should be generated during the build. I only updated the Java code.
> I did not make full unit testing but you can find "avrotest.Main" class that can be used a preliminary test.
> Please do not hesitate to contact me for further clarification if this seems interresting.
> Best regards,
> Moustapha Cherri

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