yjshen commented on a change in pull request #2068:
URL: https://github.com/apache/arrow-datafusion/pull/2068#discussion_r833077973
##########
File path: datafusion-physical-expr/src/expressions/case.rs
##########
@@ -523,6 +528,39 @@ mod tests {
Ok(())
}
+ #[test]
+ fn case_with_expr_divide_by_zero() -> Result<()> {
+ let batch = case_test_batch1()?;
+ let schema = batch.schema();
+
+ // CASE a when 0 THEN float64(null) ELSE 25.0 / cast(a, float64) END
+ let when1 = lit(ScalarValue::Int32(Some(0)));
Review comment:
Currently, we are evaluating `case_when` from the end to the beginning.
This is problematic since **short-circuit evaluation** is adopted by most
engines, including PostgreSQL, Oracle, and SQL Server. Therefore, chances are
users would express computation logic that would fail in later `when_thens` for
tuples that **should have been** computed and bypassed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]