Expand description
One Arrow frame family for raw and evaluated series chunks.
A frame carries the same thing whichever sample shape it holds: one row per chunk of one series, with that series’ identity, its finality, its time axis, and one column of samples per logical field. Field names preserve the logical series schema in order. What varies is declared rather than inferred, because the receiver of a frame has no scanner, region, or planning context to infer it from:
| Content | Identity | Time | Producer |
|---|---|---|---|
raw | key | timestamps | a storage raw-series scan |
raw | explicit | timestamps | a raw input whose labels are already decoded |
evaluated | explicit | grid_spans | a compute node’s evaluated output |
Any other combination is rejected here, because no producer can mean it: an evaluated value’s labels may be rewritten by the computation that produced it, so an evaluated frame cannot claim a storage key as its identity, and raw samples have no evaluation grid to be addressed on.
Packing accumulates bounded multi-row batches: SeriesFrameCursor walks one validated chunk
and SeriesFrameBuilder emits rows directly as Arrow arrays once a row or estimated byte bound
is reached. Decoding reuses one prepared
schema per stream through SeriesFrameDecoder. Column layout, metadata, and wire strings stay
on the single v1 contract. Raw frames may also declare greptime.series.ordering=interleaved;
older readers that do not recognize this ordering reject it. A key-encoded frame declares a
versioned
LabelDecodeSpec so its labels can be decoded from the received schema alone, and an evaluated
frame declares its GridSpec once instead of repeating timestamps.
§Label decode description versioning
The description is one greptime.series.label_decode metadata entry, and remote plans compare
greptime.series.* metadata as exact text, byte for byte: a frontend and a datanode that
write different text for the same labels disagree about the schema, and the query fails instead
of falling back. The rules that follow from that are:
- A reader rejects a version it does not implement, rather than guessing. This module writes and
reads
LABEL_DECODE_VERSIONonly. LABEL_DECODE_VERSIONcovers the whole text, including each key column’sLabelDecodeColumn::physical_type. That field is aConcreteDataType, so the text embedsConcreteDataType’s serde shape: it is not spelled here, and a change in that type’s serialization does alter this text. What keeps such a change from going unnoticed is the frozen fixturetests/compatibility/wire/raw_series_label_decode/v1_physical_types.json, which records the text of every datatype variant and fails the crate’s tests when any of them is serialized differently.- Any change to the shape of this text — a renamed or added field, a different
ConcreteDataTypespelling, a differentlogical_tagsorder — is a breaking change at the same version, because it makes two nodes of different builds disagree. Such a change must bumpLABEL_DECODE_VERSIONand update that fixture with it. - The text is canonical:
LabelDecodeSpec::canonicalizefixes the only part whose order carries no meaning, so equal labels always write equal bytes.
Deployment rule: during a rolling upgrade a frame may carry a version the receiving node does not implement, and a byte-for-byte schema comparison may fail for that reason alone. The intended behaviour is that such a mismatch disables the native series path at planning time and falls back to the generic path, instead of failing the query at execution.
TODO(narthex): implement that planning-time fallback. No planner reads
raw_series_frame_label_decode to decide support today, so a version or text mismatch currently
surfaces as an execution-time error from the raw-frame decode or the remote schema comparison.
Structs§
- Evaluated
Walk 🔒 - The walk state of one evaluated chunk.
- Frame
Row 🔒 - One pending output row: one chunk’s identity, finality, time slice, and one dense sample slice per field, with its checked encoded-size measure.
- Frame
Shape 🔒 - The two declarations the encoder and decoder dispatch on.
- Label
Decode Column - One ordered key column needed to decode key-encoded labels.
- Label
Decode Spec - Versioned, self-contained description of how to decode key-encoded labels.
- Label
Decode Tag - One logical tag name bound to a primary-key column.
- RawField
Columns 🔒 - One raw field’s payload columns, borrowed and downcast once per batch.
- RawRow 🔒
- One decoded raw row, before its chunk is built.
- RawWalk 🔒
- The walk state of one raw chunk.
- Series
Frame Builder - Bounded multi-row builder for finite series frame batches.
- Series
Frame Cursor - One validated chunk walked into a bounded builder, one row at a time.
- Series
Frame Declaration - A frame schema’s reserved declarations, parsed and cross-checked.
- Series
Frame Decoder - Reuses one prepared frame schema while decoding all batches of a stream.
- State
Frame Row - One decoded state row retaining Arrow handles for its per-field state columns.
- State
RowLayout - The Arrow layout the state rows of one publication are encoded against.
- State
Walk 🔒
Enums§
- Chunk
Walk 🔒 - Where a cursor is in the chunk it walks.
- Frame
Content - What one frame’s rows hold.
- Frame
Label Mode - How a frame names the series of its rows.
- Label
Decode Encoding - Primary-key encoding of the labels a key-encoded frame carries.
- RowPayload 🔒
- RowTime 🔒
- How one row addresses the time of its samples.
Constants§
- AGGREGATE_
COMPONENTS 🔒 - Metadata key listing the accumulator components a state frame carries, in column order.
- AGGREGATE_
KIND 🔒 - Metadata key naming the aggregate whose accumulator a state frame carries.
- CONTENT 🔒
- FIELD_
CHARGE 🔒 - Per-field charge for the payload struct, nested list and validity overhead.
- FRAME_
LAYOUT_ VERSION - The layout marker every frame this engine writes carries.
- GRID 🔒
- HISTOGRAM_
LIST_ 🔒WIDTHS - Item widths of histogram table list columns
7..=13, in that order. - HISTOGRAM_
ROW_ 🔒CHARGE - Conservative per-table-row charge: the fixed fourteen-column histogram schema has seven
primitive columns plus seven list columns whose item widths are
HISTOGRAM_LIST_WIDTHS. - HISTOGRAM_
TABLE_ 🔒CHARGE - Fixed per-histogram charge for the seven list columns’ offset and validity overhead.
- LABELS 🔒
- LABEL_
DECODE 🔒 - Metadata key of the versioned label decode description carried by key-encoded frames.
- LABEL_
DECODE_ VERSION - Version of the label decode description this revision writes and reads.
- LAYOUT 🔒
- ORDERING 🔒
- Metadata key of the producer ordering carried by a complete frame declaration.
- RESERVED_
KEYS 🔒 - Every
greptime.series.*key a frame this revision writes may carry. - ROW_
CHARGE 🔒 - Per-row charge for key/time/nullable overhead shared by every row.
- SPAN_
CHARGE 🔒 - Per-span charge for the two 64-bit coordinates one grid span carries.
- TIME 🔒
Functions§
- add_
checked 🔒 - aggregate_
state_ frame_ schema - Builds an aggregate state frame schema with explicit labels and a declared grid.
- arrow 🔒
- assemble_
frame_ 🔒batch - Builds the batch from the parts every content shares: the key, finality, time and field columns, plus the labels an explicit frame carries.
- binary_
array 🔒 - Row-level binary keys.
- binary_
slice 🔒 - bitmap_
bytes 🔒 - checked_
offset 🔒 - compact_
histogram 🔒 - down 🔒
- empty_
histogram 🔒 - A histogram with no buckets: what an absent state position holds under the shared mask.
- empty_
histogram_ 🔒table - encode_
rows 🔒 - Encodes buffered rows as one batch with direct N-row Arrow array construction.
- encode_
state_ 🔒fields - The
fieldscolumn of a state frame: one list per row, one item per carried position. - err 🔒
- float_
charge 🔒 - Float values plus their validity bitmap.
- grid_
text 🔒 - The canonical
greptime.series.gridtext of one grid. - histogram_
array_ 🔒charge - Bytes a histogram table holds: one row’s fixed part per histogram plus every bucket, span and custom bound its list columns carry, so a layout with more buckets is charged more.
- histogram_
charge 🔒 - Reference indices plus their bitmap and the full referenced histogram table.
- histogram_
table_ 🔒charge - list_
array 🔒 - list_
range 🔒 - The
(start, len)window of one list slot in its child array. - materialize_
parts 🔒 - Materializes one list child: a single constituent is cloned to keep its buffers shared.
- measure_
row 🔒 - missing_
state_ 🔒component - mul_
checked 🔒 - offset_
buffer 🔒 - pack_
raw_ series_ chunk - Packs one raw chunk, retaining the
Vec<RecordBatch>compatibility signature. - parse_
grid 🔒 - Parses one
greptime.series.gridtext back into a validated, deferrable grid. - positions_
to_ 🔒spans - raw_
field_ 🔒columns - Downcasts every field column of a raw frame’s
fieldsstruct once. - raw_
series_ frame_ schema - Builds the typed schema for a raw frame, refusing a series schema with an evaluation grid.
- reject_
nulls 🔒 - Rejects nulls in the
[start, start + len)window of one child column. - sample_
charge 🔒 - sample_
charges 🔒 - sample_
range_ 🔒growth - Measures the added dense positions without slicing Arrow arrays or rescanning histogram tables.
- segment 🔒
- The next dense segment of one field, or an error when the walk left the segment list.
- series_
frame_ label_ decode - Recovers the label decode description a frame schema declares.
- series_
frame_ schema - Builds the one frame schema family: raw or evaluated, keyed or explicit.
- state_
bool 🔒 - state_
charges 🔒 - state_
field 🔒 - The states one field of a state row carries, in the row’s own position order.
- state_
float 🔒 - state_
histogram 🔒 - state_
payload 🔒 - Reads one present position’s state as the payload family its kind keeps.
- state_
payload_ 🔒charge - Bytes one position’s state holds.
- struct_
array 🔒 - unpack_
raw_ series_ frame - Decodes all rows of one raw frame; any malformed row makes the entire call fail.
- validate_
ordering 🔒 - validity 🔒