我有两个模式文件
First是position.avsc
{
"type":"enum", "name": "Position", "namespace": "avro.examples.baseball",
"symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"]
}第二名是player.avsc
{
"type":"record", "name":"Player", "namespace": "avro.examples.baseball",
"fields": [
{"name": "number", "type": "int"},
{"name": "first_name", "type": "string"},
{"name": "last_name", "type": "string"},
{"name": "position", "type": {"type": "array", "items": "avro.examples.baseball.Position"} }
]
}I可以在avdl中导入这些模式。
@namespace("avro.examples.baseball")
protocol Baseball {
import schema "position.avsc";
import schema "player.avsc";
}但我希望在json中定义上述协议,并将这些模式导入到协议文件中。这将有助于模式的可重用性。
发布于 2016-01-07 07:13:04
可以用两种类型的文件指定Avro idl模式。
对于avpr文件,不能导入外部模式。所有必需的架构都必须显示在同一个文件中。
对于avdl,我们可以从avsc文件中导入外部模式。
我已经对阿夫罗1.7.7进行了验证
https://stackoverflow.com/questions/33416499
复制相似问题