Database Reference
In-Depth Information
Table 12-2. Avro complex types
Type
Description
Schema example
array
An ordered collection of objects. All objects in a particular array must
have the same schema.
{
"type"
:
"array"
,
"items"
:
"long"
}
An unordered collection of key-value pairs. Keys must be strings and val-
ues may be any type, although within a particular map, all values must
have the same schema.
map
{
"type"
:
"map"
,
"values"
:
"string"
}
record
A collection of named fields of any type.
{
"type"
:
"record"
,
"name"
:
"WeatherRecord"
,
"doc"
:
"A
weather
reading."
,
"fields"
: [
{
"name"
:
"year"
,
"type"
:
"int"
},
{
"name"
:
"temperature"
,
"type"
:
"int"
},
{
"name"
:
"stationId"
,
"type"
:
"string"
}
]
}
enum
A set of named values.
{
"type"
:
"enum"
,
"name"
:
"Cutlery"
,
"doc"
:
"An
eating
utensil."
,
"symbols"
:
[
"KNIFE"
,
"FORK"
,
"SPOON"
]
}