From 62e729187aff9f018dd4369e0f02b8ffd3812598 Mon Sep 17 00:00:00 2001 From: liujianhuan Date: Tue, 14 Apr 2020 17:09:03 +0800 Subject: [PATCH] dataformat part-7 --- DataIngestion/dataformats.md | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/DataIngestion/dataformats.md b/DataIngestion/dataformats.md index 4b2d9ec..1f35231 100644 --- a/DataIngestion/dataformats.md +++ b/DataIngestion/dataformats.md @@ -851,6 +851,49 @@ Avro parseSpec包含一个使用"root"或者"path"类型的 [`flattenSpec`](inge **基于Avro Bytes Decoder的 `SchemaRepo`** +Avro Bytes Decorder首先提取输入消息的 `subject` 和 `id`, 然后使用她们去查找用来解码Avro记录的Avro schema,详情可以参见 [Schema repo](https://github.com/schema-repo/schema-repo) 和 [AVRO-1124](https://issues.apache.org/jira/browse/AVRO-1124) 。 您需要一个类似schema repo的http服务来保存avro模式。有关在消息生成器端注册架构的信息,请见 `org.apache.druid.data.input.AvroStreamInputRowParserTest#testParse()` + +| 字段 | 类型 | 描述 | 是否必须 | +|-|-|-|-| +| type | String | `schema_repo` | 否 | +| subjectAndIdConverter | JSON对象 | 指定如何从消息字节中提取subject和id | 是 | +| schemaRepository | JSON对象 | 指定如何从subject和id查找Avro Schema | 是 | + +**Avro-1124 Subject 和 Id 转换器** +这部分描述了 `schema_avro` avro 字节解码器中的 `subjectAndIdConverter` 的格式 + +| 字段 | 类型 | 描述 | 是否必须 | +|-|-|-|-| +| type | String | `avro_1124` | 否 | +| topic | String | 指定Kafka流的主题 | 是 | + +**Avro-1124 Schema Repository** +这部分描述了 `schema_avro` avro 字节解码器中的 `schemaRepository` 的格式 + +| 字段 | 类型 | 描述 | 是否必须 | +|-|-|-|-| +| type | String | `avro_1124_rest_client` | 否 | +| url | String | 指定Avro-1124 schema repository的http url | 是 | + +**Confluent Schema Registry-based Avro Bytes Decoder** + +这个Avro字节解码器首先从输入消息字节中提取一个唯一的id,然后使用它在用于从字节解码Avro记录的模式注册表中查找模式。有关详细信息,请参阅schema注册 [文档](https://docs.confluent.io/current/schema-registry/index.html) 和 [存储库](https://github.com/confluentinc/schema-registry)。 + +| 字段 | 类型 | 描述 | 是否必须 | +|-|-|-|-| +| type | String | `schema_registry` | 否 | +| url | String | 指定架构注册表的url | 是 | +| capacity | 整型数字 | 指定缓存的最大值(默认为 Integer.MAX_VALUE)| 否 | + +``` +... +"avroBytesDecoder" : { + "type" : "schema_registry", + "url" : +} +... +``` + #### Protobuf Parser ### ParseSpec #### JSON解析规范