Skip to main content

keys_survive_metadata_drop

Function keys_survive_metadata_drop 

Source
pub fn keys_survive_metadata_drop<'a, 'b>(
    logical_tags: impl IntoIterator<Item = &'a str>,
    key_columns: impl IntoIterator<Item = &'b ColumnSchema>,
) -> bool
Expand description

Whether the storage key of a scan keeps telling its stored series apart once a name-dropping kernel has normalized their labels.

logical_tags are the tag names every stored series of the scan reports, and key_columns are the columns the scan keys one series by. Two facts make the drop injective, and both are read from the scan’s own binding rather than from a tree above it:

  • Neither the tags nor the key columns may be a metadata label. __type__ and __unit__ go with the metric name when a kernel drops it, so a scan that keys a series by either of them stops telling two series apart once the name is gone.
  • Every key column must always decode a value, which is what a non-nullable column states. A kernel that drops the name drops every label whose value is empty with it, and a nullable column lets one series hold NULL while another holds '': two different storage keys, which decode to an absent label and to an empty one, so both are handed over as no label at all once the empty one is dropped. Two such series that agree on every other tag then leave as one identity, whether they arrive in one partition or in two.

The physical per-series scan asks this of its own binding to decide whether a node may stream, so that its partitions hand over whole series. The plan-time canonical proof does not read it: the labels alone decide whether a metadata drop is collected, and the planner reads this rule only to count the statements that proof leaves unproved (leaves_a_drop_to_the_storage_keys). Keeping the rule here is what stops the scan’s own answer - read from the bound scan at execution - from drifting away from the one the plan-time count is stated with.