Skip to main content

Module convert

Module convert 

Source
Expand description

backbeat convert: decode a dump to sparse-wide Parquet, driven entirely by its embedded schema.

The output is one table (the layout settled in the project design):

  • Dense common columns present on every row: seq, ts_nanos, event, event_id, instance_id, plus every #[event(key)] field promoted to a top-level (nullable) column.
  • Per-event struct columns: one nullable Struct column per event type holding that event’s remaining (non-key) fields. A row carries a value only in its own event’s struct; all other struct columns are null. Parquet’s columnar encoding makes that sparsity essentially free.

Every field is decoded from its raw bytes using only the registry’s FieldType/offset/width, so the converter has no compiled-in knowledge of any event. Enums render as their label, interned ids resolve against the intern table, byte arrays render as hex. Each column carries its backbeat semantics (role, unit, span phase, description) as Arrow field metadata, and the dump’s instance_id/host go in the footer key-value metadata — so the Parquet is self-describing without copying the (potentially large) raw dump into it.

Functions§

to_parquet
Writes the records of one or more loaded dumps to output as one sparse-wide Parquet table. Returns the total row count. host overrides the dumps’ host label in the footer when non-empty. zstd_level is the zstd compression level (1–22).