| 输入 | 输出 | 别名 |
|---|---|---|
| ✔ | ✔ |
描述
ProtobufList 格式与 Protobuf 格式类似,但其中的行会表示为一系列子消息,这些子消息包含在一个名称固定为“Envelope”的消息中。
示例用法
例如:
SELECT * FROM test.table FORMAT ProtobufList SETTINGS format_schema = 'schemafile:MessageType'cat protobuflist_messages.bin | clickhouse-client --query "INSERT INTO test.table FORMAT ProtobufList SETTINGS format_schema='schemafile:MessageType'"其中,文件 schemafile.proto 如下所示:
syntax = "proto3";
message Envelope {
message MessageType {
string name = 1;
string surname = 2;
uint32 birthDate = 3;
repeated string phoneNumbers = 4;
};
MessageType row = 1;
};format_schema 中指定的消息类型会先解析为顶层 Envelope 消息内部的嵌套类型。如果未在其中找到匹配项——无论是因为 schema 中没有 Envelope 消息,还是因为 Envelope 中不包含所请求名称的消息——则直接使用该名称对应的顶层消息。