(
&self,
args: Vec<Expr>,
_info: &datafusion_expr::simplify::SimplifyContext,
)
| 80 | } |
| 81 | |
| 82 | fn simplify( |
| 83 | &self, |
| 84 | args: Vec<Expr>, |
| 85 | _info: &datafusion_expr::simplify::SimplifyContext, |
| 86 | ) -> Result<ExprSimplifyResult> { |
| 87 | let condition = args[0].clone(); |
| 88 | let then_expr = args[1].clone(); |
| 89 | let else_expr = args[2].clone(); |
| 90 | |
| 91 | // Convert IF(condition, then_expr, else_expr) to |
| 92 | // CASE WHEN condition THEN then_expr ELSE else_expr END |
| 93 | let case_expr = when(condition, then_expr).otherwise(else_expr)?; |
| 94 | |
| 95 | Ok(ExprSimplifyResult::Simplified(case_expr)) |
| 96 | } |
| 97 | } |