andygrove commented on code in PR #12049:
URL: https://github.com/apache/datafusion/pull/12049#discussion_r1723691546
##########
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() {
Review Comment:
`self.when_then_expr.len()` is always `1` in this case, so we can remove the
loop?
--
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]