【发布时间】:2016-07-19 05:04:09
【问题描述】:
我需要在 Schema 中混合“记录”类型和空类型。
"name":"specShape",
"type":{
"type":"record",
"name":"noSpecShape",
"fields":[
{
"name":"bpSsc",
"type":"null",
"default":null,
"doc":"SampleValue: null"
},...
例如,对于某些数据,specShape 可能为空。
所以如果我将类型设置为
"name":"specShape",
"type":{
**"type":["record", "null"],**
"name":"noSpecShape",
"fields":[
{
"name":"bpSsc",
"type":"null",
"default":null,
"doc":"SampleValue: null"
},...
它说
No type: {"type":["record","null"]...
但是如果我将整体类型设置为
"name":"specShape",
**"type":[{
"type":"record",
"name":"noSpecShape",
"fields":[
{
"name":"bpSsc",
"type":"null",
"default":null,
"doc":"SampleValue: null"
}, "null"]**,...
它说
Not in union [{"type":"record"
如何联合这两种类型?
【问题讨论】:
标签: null schema union record avro