andygrove commented on code in PR #12049:
URL: https://github.com/apache/datafusion/pull/12049#discussion_r1723692420


##########
datafusion/physical-expr/src/expressions/case.rs:
##########
@@ -386,6 +420,47 @@ impl CaseExpr {
 
         Ok(ColumnarValue::Array(zip(&when_value, &then_value, &else_)?))
     }
+
+    fn divide_by_zero_expr(&self, batch: &RecordBatch) -> 
Result<ColumnarValue> {
+        let return_type = self.data_type(&batch.schema())?;
+
+        // start with nulls as default output
+        let mut current_value = new_null_array(&return_type, batch.num_rows());
+        let mut remainder = BooleanArray::from(vec![true; batch.num_rows()]);
+        let when_value = BooleanArray::from(vec![true; batch.num_rows()]);
+        for i in 0..self.when_then_expr.len() {
+            let then_value = self.when_then_expr[i]
+                .1
+                .evaluate(batch)?;

Review Comment:
   yes, adding a new div function that can check for zero would seem ideal



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to