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

Doug Cutting commented on AVRO-1285:
------------------------------------

Sorry, I missed the "circular" part in the original description!

Note that Avro can actually parse print a circular schema as a finite 
expression.

For example, your A can be defined as:
{code}
{"name":"A", "type":"record", "fields":[
    {"name":"x", "type": {"name":"B", "type":"record", "fields":[{"name":"y", 
"type":"A"}
  ]
}
{code}

and B can either be defined as a standalone schema, with:
{code}
{"name":"B", "type":"record", "fields":[
    {"name":"y", "type": {"name":"A", "type":"record", "fields":[{"name":"x", 
"type":"B"}
  ]
}
{code}

or, in the context of the above definition of A (using AVRO-872, AVRO-877, 
AVRO-1188), as:
{code}
{"name":"B", "type":"record", "fields":[{"name":"y", "type":"A"}]}
{code}

So A and B can be defined in separate files, but at least one must currently 
include the definition of the other.  Changing the parser to fix this is 
possible, but perhaps not trivial.
                
> Avro schema compile does not support circular reference
> -------------------------------------------------------
>
>                 Key: AVRO-1285
>                 URL: https://issues.apache.org/jira/browse/AVRO-1285
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>            Reporter: Viji
>            Priority: Minor
>         Attachments: multipass.tar
>
>
> While declaring a Schema, doing a circular reference is not possible if the 
> Schema for the external reference is in another file. Attached is a project 
> that provides 2 schemas that exhibits this missing feature.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to