Function mz_expr::permutation_for_arrangement
source ยท pub fn permutation_for_arrangement(
key: &[MirScalarExpr],
unthinned_arity: usize,
) -> (Vec<usize>, Vec<usize>)
Expand description
Derive supporting logic to support transforming rows to (key, val) pairs, and back again.
We are given as input a list of key expressions and an input arity, and the
requirement the produced key should be the application of the key expressions.
To produce the val
output, we will identify those input columns not found in
the key expressions, and name all other columns.
To reconstitute the original row, we identify the sequence of columns from the
concatenation of key and val which would reconstruct the original row.
The output is a pair of column sequences, the first used to reconstruct a row from the concatenation of key and value, and the second to identify the columns of a row that should become the value associated with its key.
The permutations and thinning expressions generated here will be tracked in
dataflow::plan::AvailableCollections
; see the
documentation there for more details.