Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 08A7711A2D for ; Wed, 2 Jul 2014 22:11:27 +0000 (UTC) Received: (qmail 17521 invoked by uid 500); 2 Jul 2014 22:11:26 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 17447 invoked by uid 500); 2 Jul 2014 22:11:26 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 17433 invoked by uid 99); 2 Jul 2014 22:11:26 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jul 2014 22:11:26 +0000 Date: Wed, 2 Jul 2014 22:11:26 +0000 (UTC) From: "Doug Cutting (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AVRO-695) Cycle Reference Support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AVRO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14050789#comment-14050789 ] Doug Cutting commented on AVRO-695: ----------------------------------- For some reason I cannot apply the patch file you've generated, so it's hard for me to analyze it in detail. What tool are you using to generate this patch? I'd prefer we use an explicit type rather than overload string for this purpose. A union with a record like: {code} {"type":"record","name":"org.apache.avro.CircularRef", "fields":[{"name":"ref", "type":int}]} {code} We don't ever have to create or define such a record. Rather, a CustomEncoding can be used to directly resolve such references at read time. (If circular references are not enabled then a GenericRecord would be read.) No string prefixing, etc. would then be required. Rather than modifying ReflectData to support this, might we instead create a subclass of ReflectData that supports circular references? Non-string map key support in reflection should be addressed in a separate issue. > 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.7.6 > Reporter: Moustapha Cherri > Attachments: avro-1.4.1-cycle.patch.gz, avro-1.4.1-cycle.patch.gz, avro_circular_references.zip, avro_circular_refs_2014_06_14.zip, circular_refs_and_nonstring_map_keys_2014_06_25.zip > > 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 was sent by Atlassian JIRA (v6.2#6252)