What would be the equivalent avro schema for following class
class A {
String s;
List<String> l;
}
I have following, but its doesnt work:
{
"name" : "A",
"type": "record",
"fields": [
{
"name": "s",
"type": "string"
},
{
"name": "l"
"type": "array",
"items": "string"
}
]
}
I believe the array
type needs to be nested in another dictionary like so:
{
"name" : "A",
"type": "record",
"fields": [
{
"name": "s",
"type": "string"
},
{
"name": "l"
"type": {
"array",
"items": "string"
}
}
]
}
You can use Avro IDL to basically have the same thing
protocol SampleProtocol {
record A {
string s;
array<string> l;
}
}
You can refer the Avro documentation on how to actually get a Java Arraylist class when generating the class, otherwise it's an array
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.