Function mz_expr::canonicalize::canonicalize_equivalences

source ·
pub fn canonicalize_equivalences<'a, I>(
    equivalences: &mut Vec<Vec<MirScalarExpr>>,
    input_column_types: I,
)
where I: Iterator<Item = &'a Vec<ColumnType>>,
Expand description

Canonicalize equivalence classes of a join and expressions contained in them.

input_types can be the ColumnTypes of the join or the ColumnTypes of the individual inputs of the join in order.

This function:

  • simplifies expressions to involve the least number of non-literal nodes. This ensures that we only replace expressions by “even simpler” expressions and that repeated substitutions reduce the complexity of expressions and a fixed point is certain to be reached. Without this rule, we might repeatedly replace a simple expression with an equivalent complex expression containing that (or another replaceable) simple expression, and repeat indefinitely.
  • reduces all expressions contained in equivalences.
  • Does everything that canonicalize_equivalence_classes does.