Expand description
Flattens a protobuf message type into an Arrow schema, matching the
semantic policies documented in flatten and wrapper. Generic and
self-contained: no runtime wire-decode, no product-specific assumptions -
just descriptor-to-schema computation.
let bytes = std::fs::read("some_descriptor.pb").unwrap();
let schema = twg_proto_schema::build_arrow_schema(&bytes, "some.package.MyMessage", 2)?;Enums§
Constants§
- MAX_
STRUCT_ DEPTH - Default safety limit for constructing a genuine nested Struct /
List<Struct>type once something is no longer being flattened into named columns - independent of and unrelated toflatten_depth. Raised from the historical 12 to 64 so realistically-deep schemas type natively rather than collapsing toUtf8; callers that need a different bound pass one explicitly viabuild_arrow_schema_with_struct_depth.
Functions§
- build_
arrow_ schema - Decodes
descriptor_set_bytesas a protobufFileDescriptorSet(must be compiled withprotoc --include_importsso every referenced type is present in the set), resolvesmessage_type(fully-qualified; a leading ‘.’ is added if missing), and flattens its fields into an Arrow schema. - build_
arrow_ schema_ with_ struct_ depth build_arrow_schemawith an explicitmax_struct_depth, the safety limit on native nested-Struct/Map-value recursion before a sub-message falls back toUtf8-JSON. The default (MAX_STRUCT_DEPTH) suits almost every schema; raise it for an unusually deep message graph, lower it to cap decode cost. Distinct fromflatten_depth(flat-column expansion).- compile_
proto_ to_ bytes - Compiles one or more
.protofiles directly toFileDescriptorSetbytes, without needing aprotocbinary onPATH-protoxparses and resolves.protosyntax itself (pure Rust). Equivalent toprotoc --include_importsin that every type reachable fromproto_paths(viainclude_paths) ends up present in the set, whichbuild_arrow_schema(and any decode crate built on top of this) requires.