On 05/15/2010 02:08 PM, Scott Carey wrote:
On May 14, 2010, at 12:18 PM, Doug Cutting wrote:
To construct a recursive schema programmatically you need to do
what the schema parser does: create a record schema with
createSchema(), create it's fields, including one or more that
references the record schema, then call setFields() with the
fields.

Excellent.  I'll do that.  This means that the recursion points that
avro supports can only be records, right?

Yes, in the existing API.

Only a record has the
equivalent of setFields(), everything else that can contain another
element (arrays, unions) must declare the inner element(s) at
creation time.

A union-of-unions is illegal, but an array-of-arrays is not. So it might make sense to add a method like setElementType() if you need to use arrays as the recursion point.

Doug

Reply via email to