diff --git a/core/src/execution/datafusion/expressions/if_expr.rs b/core/src/execution/datafusion/expressions/if_expr.rs index 826f017c12..0af079c307 100644 --- a/core/src/execution/datafusion/expressions/if_expr.rs +++ b/core/src/execution/datafusion/expressions/if_expr.rs @@ -112,8 +112,8 @@ impl PhysicalExpr for IfExpr { fn children(&self) -> Vec> { vec![ - self.true_expr.clone(), self.if_expr.clone(), + self.true_expr.clone(), self.false_expr.clone(), ] } @@ -218,4 +218,16 @@ mod tests { Ok(()) } + + #[test] + fn test_if_children() { + let if_expr = lit(true); + let true_expr = lit(123i32); + let false_expr = lit(999i32); + + let expr = if_fn(if_expr, true_expr, false_expr); + let children = expr.unwrap().children(); + assert_eq!(children.len(), 3); + assert_eq!(children[0].to_string(), "true"); + } }