avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Carey <sc...@richrelevance.com>
Subject Re: does the map need to be embedded in a record
Date Wed, 13 Apr 2011 17:16:00 GMT
In general you don't need to wrap an unnamed complex type (map, array, union) in a record.

Some language APIs might not support these 'naked' types with the same level of ease that
they support named ones.

Note in your schema below the "name" field -- "mapping" is completely ignored.  Maps don't
have names.

Other 'nameless' schemas are ones with a single intrinsic data type, like:

{ "type": "int" }


On 4/13/11 9:52 AM, "Weishung Chung" <weishung@gmail.com<mailto:weishung@gmail.com>>
wrote:

Hello,

I have a question about Avro schema. Does the map type need to be embedded in a record? Could
I have a schema like this without embedding the map in a record?

{
    "name": "mapping",
    "type": "map",
    "values":{
        "type":"record",
        "name":"hi",
        "fields":[
            {"name":"a","type":"string"},
            {"name":"b","type":"string"}
        ]
    }
}


Thank you


Mime
View raw message