From 4c48ddc07c7991d1b27da69641fedff5422ade8e Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Mon, 15 Jul 2024 21:01:33 -0600 Subject: [PATCH] fix --- native/core/src/execution/datafusion/planner.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/core/src/execution/datafusion/planner.rs b/native/core/src/execution/datafusion/planner.rs index e4ddfda3f..ce734c8af 100644 --- a/native/core/src/execution/datafusion/planner.rs +++ b/native/core/src/execution/datafusion/planner.rs @@ -59,7 +59,6 @@ use datafusion_expr::expr::find_df_window_func; use datafusion_expr::{ScalarUDF, WindowFrame, WindowFrameBound, WindowFrameUnits}; use datafusion_physical_expr::window::WindowExpr; use datafusion_physical_expr_common::aggregate::create_aggregate_expr; -use datafusion_physical_expr_common::expressions::Literal; use itertools::Itertools; use jni::objects::GlobalRef; use num::{BigInt, ToPrimitive}; @@ -547,8 +546,9 @@ impl PhysicalPlanner { // optimized path for CASE WHEN predicate THEN expr ELSE null END if else_phy_expr.is_none() && when_then_pairs.len() == 1 { let when_then = &when_then_pairs[0]; - // ExprOrNull does not support scalar expressions - if !when_then.1.as_any().is::() { + // ExprOrNull is only safe to use for expressions that do not + // have side-effects. For now, limit the use to raw column references + if when_then.1.as_any().is::() { return Ok(Arc::new(ExprOrNull::new( when_then.0.clone(), when_then.1.clone(),