Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Avro >> mail # user >> Recursively nested arrays


+
Michael Artz 2011-03-23, 02:52
Copy link to this message
-
Re: Recursively nested arrays
> Is there a way to structure a schema to support recursively nested arrays, i.e. an arbitrary number of arrays within arrays?  As I haven't found a way to reference an array/items "type" by name, I'm not sure that its possible.  Anyone know any better?

You need a wrapper record, to give you something that you can name:

{
  "type": "record",
  "name": "foo",
  "fields": [
    { "name": "contents", "type": { "type": "array", "items": "foo" } }
  ]
}

In general, you always need a record if you want a recursive type, since records are the only things that both (a) have names, and (b) can contain subschemas.

–doug
+
Scott Carey 2011-03-23, 16:30
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB