Skip to main content

normalize

Function normalize 

Source
pub fn normalize(
    expression: Expression,
    dnf: bool,
    max_distance: i64,
) -> NormalizeResult<Expression>
Expand description

Rewrite SQL AST into Conjunctive Normal Form (CNF) or Disjunctive Normal Form (DNF).

CNF (default): (x AND y) OR z => (x OR z) AND (y OR z) DNF: (x OR y) AND z => (x AND z) OR (y AND z)

§Arguments

  • expression - Expression to normalize
  • dnf - If true, convert to DNF; otherwise CNF (default)
  • max_distance - Maximum estimated distance before giving up

§Returns

The normalized expression, or the original if normalization would be too expensive.