pub struct ConstEvaluator<'a> { /* private fields */ }
Expand description

Partially evaluate Exprs so constant subtrees are evaluated at plan time.

Note it does not handle algebraic rewrites such as (a or false) –> a, which is handled by [Simplifier]


let execution_props = ExecutionProps::new();
let mut const_evaluator = ConstEvaluator::try_new(&execution_props).unwrap();

// (1 + 2) + a
let expr = (lit(1) + lit(2)) + col("a");

// is rewritten to (3 + a);
let rewritten = expr.rewrite(&mut const_evaluator).unwrap();
assert_eq!(rewritten, lit(3) + col("a"));

Implementations

Create a new ConstantEvaluator. Session constants (such as the time for now() are taken from the passed execution_props.

Trait Implementations

Invoked before any children of expr are rewritten / visited. Default implementation returns Ok(RewriteRecursion::Continue) Read more
Invoked after all children of expr have been mutated and returns a potentially modified expr. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.