Hi,

My apologies in advance if this topic has been well discussed before - the
mailing list search tool appears to be broken (the link points to the
expired domain name "search-hadoop.com").

I'm trying to understand about recursive types in Avro, given that the
specification says about names
<http://avro.apache.org/docs/current/spec.html#names>:

a name must be defined before it is used ("before" in the depth-first,
> left-to-right traversal of the JSON parse tree, where the types attribute
> of a protocol is always deemed to come "before" the messages attribute.)


By my reading, this would make the following Avro schema invalid, because
the name "R" will not yet be defined when it's referenced inside the type
of the field F, because in depth-first order, the leaf is traversed before
the root.

{
    "type": "record",
    "fields": [
        {"name": "F", "type": ["null", "R"]}
    ],
    "name": "R"
}

It seems that types like this are valid in practice (I found the above
example in an Avro test suite), so could someone enlighten me as to how
this is allowed, please?

Thanks for any info. If I'm asking in the wrong place, please advise me of
a better forum!

    rog.

Reply via email to