我有以下工会:
{
"name" : "price",
"type" : [ "null", {
"type" : "array",
"items" : {
"type" : "record",
"name" : "PriceType",
"fields" : [ {
"name" : "text_value",
"type" : [ "null", "double" ],
"source" : "element text_value"
}, {
"name" : "currency",
"type" : [ "null", "string" ],
"default" : null,
"source" : "attribute currency"
} ]
}
} ],
"default" : null,
"source" : "element price"
}
从这个联合体中,我使用以下代码得到price字段的模式:
Schema new_schema=schema.getField("price").schema();
现在我想得到联合体的模式:
{
"type" : "array",
"items" : {
"type" : "record",
"name" : "PriceType",
"fields" : [ {
"name" : "text_value",
"type" : [ "null", "double" ],
"source" : "element text_value"
}, {
"name" : "currency",
"type" : [ "null", "string" ],
"default" : null,
"source" : "attribute currency"
}
我该怎么做?我该如何在记录中插入一个并集?
暂无答案!
目前还没有任何答案,快来回答吧!