simplify_const_expr

Function simplify_const_expr 

Source
pub fn simplify_const_expr(
    expr: &Arc<dyn PhysicalExpr>,
) -> Result<Transformed<Arc<dyn PhysicalExpr>>>
Expand description

Simplify expressions that consist only of literals by evaluating them.

This function checks if all children of the given expression are literals. If so, it evaluates the expression against a dummy RecordBatch and returns the result as a new Literal.

ยงExample transformations

  • 1 + 2 -> 3
  • (1 + 2) * 3 -> 9 (with bottom-up traversal)
  • 'hello' || ' world' -> 'hello world'