AWS Glue Schema Registry是否支持Avro自定义类型跨Schema复用?
Avro自定义类型跨Schema复用:AWS Glue Schema Registry支持情况咨询
已实现的本地复用方案(基于avro-maven-plugin)
我已经通过avro-maven-plugin实现了Avro Schema之间自定义类型的复用,具体配置和Schema示例如下:
1. 共享自定义类型Schema
文件路径:shared/child_type.avsc
{ "namespace": "my.namespace", "type": "record", "name": "ChildType", "fields": [ ... ] }
2. 依赖自定义类型的父Schema
文件路径:parent_type.avsc(其中字段field_of_custom_type引用了自定义类型)
{ "namespace": "my.namespace", "type": "record", "name": "ParentType", "fields": [ { "name": "field_of_custom_type", "type": "my.namespace.ChildType" } ] }
3. Maven插件配置(核心是imports配置)
<plugin> <groupId>org.apache.avro</groupId> <artifactId>avro-maven-plugin</artifactId> <version>${avro.version}</version> <configuration> <sourceDirectory>${avro.sourceDirectory}</sourceDirectory> <outputDirectory>${avro.outputDirectory}</outputDirectory> <imports> <import>${avro.sourceDirectory}/shared</import> </imports> </configuration> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>schema</goal> </goals> </execution> </executions> </plugin>
我了解到Confluent Schema Registry支持这类跨Schema复用自定义类型的特性,但不确定AWS Glue Schema Registry是否同样支持该功能?
在尝试将这种复用方式应用到AWS Glue Schema Registry时,我遇到了以下报错:
InvalidInputException: Schema definition is invalid: "my.namespace.ChildType" is not a defined name. The type of the "field_of_custom_type" field must be a defined name or a {"type": ...} expression.
内容的提问来源于stack exchange,提问作者Sigoy
相关产品推荐
相关产品推荐

