You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/24 02:51:14 UTC

[GitHub] [arrow-datafusion] doki23 commented on a change in pull request #2068: WIP: case when should only evaluate `then` clause for true `when`'s

doki23 commented on a change in pull request #2068:
URL: https://github.com/apache/arrow-datafusion/pull/2068#discussion_r833872460



##########
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:
       We can evaluate `case_when` from beginning to the end and use evaluate_selection for the when_expr so that we can omit the following computation of when expr of the record which when_expr is already true.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org