Skip to main content

ensure_frame_matches_label_source

Function ensure_frame_matches_label_source 

Source
pub fn ensure_frame_matches_label_source(
    frame: &Schema,
    label_source: &RawLabelSource,
) -> Result<()>
Expand description

Checks that a frame declares the label decode layout a scan-bound binding describes.

This compares one thing: the description parsed from the frame’s greptime.series.label_decode metadata against the description derived from label_source, by plain equality. A difference in the version, the metric name, the primary-key encoding, the ordered key columns and their physical types, or the logical tags is a mismatch. Nothing else is compared, so agreeing descriptions do not establish that these are the region’s chunks: no region id, table id, or provenance is part of either side, and two regions whose tags have the same ids, names, and types produce equal descriptions. The check answers “does this frame describe the label layout this binding expects”, never “is this the region I asked for”.

It belongs to the caller that holds both sides: a frame describes its own labels, so unpack_raw_series decodes it without a binding, and a caller that received the frame from a peer compares the declaration here instead of decoding under whichever side it trusts.

The comparison is plain equality. The writer canonicalizes the description (see [LabelDecodeSpec::canonicalize]), so a description that reaches a reader already has one spelling and equality says everything there is to say about it.