Slide 5
Slide 5 text
Data Serialization Using Apache Avro
5
Schema Definition
{
"namespace": "com.puter.avro",
"type": "record",
"name": "Employee",
"fields": [
{"name": "name", "type": "string"},
{"name": "dob", "type": "timestamp"},
{"name": "height", "type": "int"},
{"name": "previosCompany", "type": "string"},
{"name": "favoriteColor", "type": ["string", "null"]}
]
}
{
"namespace": "com.puter.avro",
"type": "record",
"name": "Employee",
"fields": [
{"name": "name", "type": "string"},
{"name": "dob", "type": "timestamp"},
{"name": "height", "type": "int"},
{"name": "previosCompany", "type": "string"},
{"name": "favoriteColor", "type": ["string", "null"]}
]
}
A Schema is represented in JSON:
●
Primitive Types : null, boolean, int, long, float, double, bytes, string
●
Complex Types : records, enums, arrays, maps, unions and fixed