跳到主要内容
版本:Next
arrow_to_protobufprotobuf_to_arrowINPUTBUFFERPROCESSOROUTPUT

Protobuf

The Protobuf processor converts between Apache Arrow batches and Protocol Buffers messages. It registers two processor types: arrow_to_protobuf serializes Arrow columns into Protobuf binary data, and protobuf_to_arrow decodes Protobuf binary data into an Arrow batch. Message descriptors are loaded from .proto source files (or prebuilt descriptor sets).

Configuration

Both types share proto_inputs, proto_includes, and message_type. Additional fields apply only to one direction of conversion, as noted below.

FieldTypeRequiredDefaultDescription
typestringyesarrow_to_protobuf | protobuf_to_arrow
proto_inputsarray<string>yesPaths to .proto files (or descriptor set binaries) describing the message type.
proto_includesarray<string>noDirectories to search when resolving Protobuf imports.
message_typestringyesFully qualified Protobuf message type name (e.g. example.MyMessage).
value_fieldstringnoName of the binary field holding Protobuf data. Applies to protobuf_to_arrow only; defaults to the engine default binary value field.
fields_to_includearray<string>noRestrict the columns serialized to Protobuf. Applies to arrow_to_protobuf only; when omitted all fields are included.

Examples

Arrow to Protobuf

- type: "arrow_to_protobuf"
proto_inputs: ["./examples/message.proto"]
message_type: "message.Message"
fields_to_include:
- "field1"
- "field2"

Protobuf to Arrow

- type: "protobuf_to_arrow"
proto_inputs: ["./examples/message.proto"]
message_type: "message.Message"
value_field: "data"

Notes

Data Type Mapping

Protobuf to Arrow type conversions:

Protobuf TypeArrow TypeNotes
boolBoolean
int32, sint32, sfixed32Int32
int64, sint64, sfixed64Int64
uint32, fixed32UInt32
uint64, fixed64UInt64
floatFloat32
doubleFloat64
stringUtf8
bytesBinary
enumInt32Stored as enum number