pub fn merge_label_rewrites(
tree: &NativeTree,
source_tags: &[Vec<String>],
source_metrics: &[Option<Arc<str>>],
) -> Result<NativeTree>Expand description
Rewrites tree so that every consumer of a whole canonical series is handed one.
source_tags is what the caller knows about each fused input’s tags, indexed by the
source_index of the BoundInput each leaf was bound to; a
source the caller says nothing about proves nothing, and a rewrite over it is collected. The
index is what a leaf reads, so a tree with several sources is judged source by source.
source_metrics is the other half of that knowledge, indexed the same way: the one metric each
source is bound to, or None when it may hand over several. It is what lets a kernel that drops
the metadata labels keep every partition - see
duplicates_canonical_labels - and a caller
that cannot say collects instead.
Every operation binding and every source_index stays where it was, so the rewrite changes which
series a consumer reads and not what the query computes. The result is checked by
NativeTree::try_new, because a merge has to sit over an evaluated vector and the pass may
only put it there.