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

Method plan_divide

src/sql/src/plan/transform_ast.rs:105–112  ·  view source on GitHub ↗

Divides `lhs` by `rhs` but replaces division-by-zero errors with NULL; note that this is semantically equivalent to `NULLIF(rhs, 0)`.

(lhs: Expr<Aug>, rhs: Expr<Aug>)

Source from the content-addressed store, hash-verified

103 // Divides `lhs` by `rhs` but replaces division-by-zero errors with NULL;
104 // note that this is semantically equivalent to `NULLIF(rhs, 0)`.
105 fn plan_divide(lhs: Expr<Aug>, rhs: Expr<Aug>) -> Expr<Aug> {
106 lhs.divide(Expr::Case {
107 operand: None,
108 conditions: vec![rhs.clone().equals(Expr::number("0"))],
109 results: vec![Expr::null()],
110 else_result: Some(Box::new(rhs)),
111 })
112 }
113
114 fn plan_agg(
115 &mut self,

Callers

nothing calls this directly

Calls 1

divideMethod · 0.80

Tested by

no test coverage detected