MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / plan_expr_inner

Function plan_expr_inner

src/sql/src/plan/query.rs:4054–4166  ·  view source on GitHub ↗
(
    ecx: &'a ExprContext,
    e: &Expr<Aug>,
)

Source from the content-addressed store, hash-verified

4052}
4053
4054fn plan_expr_inner<'a>(
4055 ecx: &'a ExprContext,
4056 e: &Expr<Aug>,
4057) -> Result<CoercibleScalarExpr, PlanError> {
4058 if let Some((i, item)) = ecx.scope.resolve_expr(e) {
4059 // We've already calculated this expression.
4060 return Ok(HirScalarExpr::named_column(
4061 i,
4062 ecx.qcx.name_manager.borrow_mut().intern_scope_item(item),
4063 )
4064 .into());
4065 }
4066
4067 match e {
4068 // Names.
4069 Expr::Identifier(names) | Expr::QualifiedWildcard(names) => {
4070 Ok(plan_identifier(ecx, names)?.into())
4071 }
4072
4073 // Literals.
4074 Expr::Value(val) => plan_literal(val),
4075 Expr::Parameter(n) => plan_parameter(ecx, *n),
4076 Expr::Array(exprs) => plan_array(ecx, exprs, None),
4077 Expr::List(exprs) => plan_list(ecx, exprs, None),
4078 Expr::Map(exprs) => plan_map(ecx, exprs, None),
4079 Expr::Row { exprs } => plan_row(ecx, exprs),
4080
4081 // Generalized functions, operators, and casts.
4082 Expr::Op { op, expr1, expr2 } => {
4083 Ok(plan_op(ecx, normalize::op(op)?, expr1, expr2.as_deref())?.into())
4084 }
4085 Expr::Cast { expr, data_type } => plan_cast(ecx, expr, data_type),
4086 Expr::Function(func) => Ok(plan_function(ecx, func)?.into()),
4087
4088 // Special functions and operators.
4089 Expr::Not { expr } => plan_not(ecx, expr),
4090 Expr::And { left, right } => plan_and(ecx, left, right),
4091 Expr::Or { left, right } => plan_or(ecx, left, right),
4092 Expr::IsExpr {
4093 expr,
4094 construct,
4095 negated,
4096 } => Ok(plan_is_expr(ecx, expr, construct, *negated)?.into()),
4097 Expr::Case {
4098 operand,
4099 conditions,
4100 results,
4101 else_result,
4102 } => Ok(plan_case(ecx, operand, conditions, results, else_result)?.into()),
4103 Expr::HomogenizingFunction { function, exprs } => {
4104 plan_homogenizing_function(ecx, function, exprs)
4105 }
4106 Expr::NullIf { l_expr, r_expr } => Ok(plan_case(
4107 ecx,
4108 &None,
4109 &[l_expr.clone().equals(*r_expr.clone())],
4110 &[Expr::null()],
4111 &Some(Box::new(*l_expr.clone())),

Callers 1

plan_exprFunction · 0.85

Calls 15

plan_identifierFunction · 0.85
plan_literalFunction · 0.85
plan_parameterFunction · 0.85
plan_arrayFunction · 0.85
plan_listFunction · 0.85
plan_mapFunction · 0.85
plan_rowFunction · 0.85
plan_opFunction · 0.85
opFunction · 0.85
plan_functionFunction · 0.85
plan_notFunction · 0.85
plan_andFunction · 0.85

Tested by

no test coverage detected