pub fn is_pure(expr: &ExprImpl) -> boolExpand description
Returns whether every function in the expression always produces the same result for the same inputs, so that the expression can be re-evaluated or moved by the optimizer.
- Built-in scalar and table functions are pure when they are deterministic, as classified by
ImpureAnalyzer.NOW,PROCTIMEand secret references are impure. - User-defined scalar functions are pure when they are declared
IMMUTABLE. The planner trusts the declaration; it cannot verify the implementation. User-defined table functions are always impure.
A pure expression may still have its evaluated results materialized on retract streams: a UDF
keeps materialization unless it sets unsafe_skip_materializing_exprs. Whether an expression
needs materialization is decided by needs_materialization.