Expand description
Expression simplification pass for query optimization
This module provides expression simplification that runs before planning. It handles:
- Constant folding (1 + 1 → 2)
- Boolean simplification (TRUE AND x → x, FALSE OR x → x)
- Tautology elimination (1 = 1 → TRUE, x = x → TRUE for NOT NULL cols)
- Contradiction detection (1 = 2 → FALSE)
- Range predicate merging (a > 5 AND a > 3 → a > 5)
- De Morgan’s law application where beneficial
IMPORTANT: This module uses Option<Expression> returns to avoid cloning
expressions when no simplification is performed. This is critical for
performance with heavy expressions like EXISTS subqueries.
Structs§
- Expression
Simplifier - Expression simplifier that applies optimization rules
Functions§
- simplify_
expression - Convenience function to simplify an expression
- simplify_
expression_ fixed_ point - Repeatedly simplify until no more changes