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 >> Is it possible to parse multiple schema definitions in one string?


+
Benyi Wang 2013-06-14, 19:07
Copy link to this message
-
Re: Is it possible to parse multiple schema definitions in one string?
You can put them in square brackets, defining a union, then use
Schema#getTypes() to return the list of schemas defined.

http://avro.apache.org/docs/current/api/java/org/apache/avro/Schema.html#getTypes()

Doug

On Fri, Jun 14, 2013 at 12:07 PM, Benyi Wang <[EMAIL PROTECTED]> wrote:
> Is there a way to pass a string to Schema.Parser include multiple schema
> definitions?
>
>      { "type": "record",
>         "name": "Date",
>         "fields" : [ { "name": "date", "type": "long" }]
>       }
>
>      { "type": "record",
>         "name": "Transaction",
>         "fields": [
>          { "name": "id", "type": "int" },
>          { "name": "tx_date", "type": "Date" } ]
>       }
>
>      { "type": "record",
>         "name": "Customer",
>         "fields": [
>          { "name": "id", "type": "int" },
>          { "name": "birthday", "type": "Date" } ]
>       }
>
> Transaction and Customer refers Date.
+
Bertrand Dechoux 2013-06-15, 10:23
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