avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Carey <sc...@richrelevance.com>
Subject Re: Avro 1.4.1 Compiled Schema Missing wrapper collection
Date Fri, 01 Apr 2011 17:15:12 GMT
On 3/31/11 4:56 PM, "felix gao" <gre1600@gmail.com<mailto:gre1600@gmail.com>> wrote:

I have create a schema as


      "namespace": "avro.test",

      "name": "testTransferObject",

      "type": "map",

      "values": {

      "type": "array",

      "items" : {

      "type" : "map",

      "values" : {


      "name" : "entry",

      "type" : "record",

      "fields" : [

      {"name":"Id", "type":"int"},

      {"name":"Category1", "type":"long"},

      {"name":"Category2", "type":"long"},

      {"name":"Segment1", "type":"long"},

      {"name":"Segment2", "type":"long"},

      {"name":"index", "type":"double"}






The code generated by pecificCompiler.compileSchema only contains entry under the package
avro.test.  I am wondering where is the Map and Array go?

Avro maps and arrays become java  Map and List objects respectively.  There is no reason to
compile them.  The SpecificRecord for the array above is:
List<Map<Utf8, avro.test.entry>>
As Doug points out, the top level map is not a named data type, so it is not generated.  Only
record, enum, and fixed result in generated classes.  In code it would be of type:
Map<Utf8, List<Map<Utf8, avro.test.entry>>>

And the wrapper object testTransferObject does not seems to be generated.



View raw message