aweltsch commented on code in PR #13953:
URL: https://github.com/apache/datafusion/pull/13953#discussion_r1900766412


##########
datafusion/physical-expr/src/expressions/case.rs:
##########
@@ -394,6 +401,43 @@ impl CaseExpr {
 
         Ok(ColumnarValue::Array(zip(&when_value, &then_value, &else_)?))
     }
+
+    fn expr_or_expr(&self, batch: &RecordBatch) -> Result<ColumnarValue> {
+        let return_type = self.data_type(&batch.schema())?;
+
+        // evalute when condition on batch
+        let when_value = self.when_then_expr[0].0.evaluate(batch)?;
+        let when_value = when_value.into_array(batch.num_rows())?;
+        let when_value = as_boolean_array(&when_value).map_err(|e| {
+            DataFusionError::Context(
+                "WHEN expression did not return a BooleanArray".to_string(),
+                Box::new(e),
+            )

Review Comment:
   Thanks @2010YOUY01 for the feedback. I was not aware that all of the 
type-checking is guaranteed at this point.
   One of my main motivations to have this here was to keep it consistent with 
the rest of the code in the file to minimize any deviation from the previous 
behavior. I can apply this change for the newly added code, what should happen 
to the rest of the code? Do you think it would make sense to add a new issue to 
clean-up the other functions to?



-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to