Expand description
Boolean expression normalization (CNF/DNF) Boolean Normalization Module
This module provides functionality for converting SQL boolean expressions to Conjunctive Normal Form (CNF) or Disjunctive Normal Form (DNF).
CNF: (a OR b) AND (c OR d) - useful for predicate pushdown DNF: (a AND b) OR (c AND d) - useful for partition pruning
Ported from sqlglot’s optimizer/normalize.py
Enums§
- Normalize
Error - Errors that can occur during normalization
Constants§
- DEFAULT_
MAX_ DISTANCE - Maximum default distance for normalization
Functions§
- normalization_
distance - Calculate the normalization distance for an expression.
- normalize
- Rewrite SQL AST into Conjunctive Normal Form (CNF) or Disjunctive Normal Form (DNF).
- normalized
- Check whether a given expression is in a normal form.
Type Aliases§
- Normalize
Result - Result type for normalization operations