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/01/18 16:01:11 UTC
[GitHub] [arrow-datafusion] alamb commented on a change in pull request #1601: fix: casting Int64 to Float64 unsuccessfully caused tpch8 to fail
alamb commented on a change in pull request #1601:
URL: https://github.com/apache/arrow-datafusion/pull/1601#discussion_r786905414
##########
File path: datafusion/src/physical_plan/expressions/case.rs
##########
@@ -324,7 +325,10 @@ impl CaseExpr {
// start with the else condition, or nulls
let mut current_value: Option<ArrayRef> = if let Some(e) = &self.else_expr {
- Some(e.evaluate(batch)?.into_array(batch.num_rows()))
+ // keep `else_expr`'s data type and return type consistent
Review comment:
Eventually it would be great to separate out the `coercion` logic into the `
```rust
/// Create a CASE expression
pub fn case(
expr: Option<Arc<dyn PhysicalExpr>>,
when_thens: &[WhenThen],
else_expr: Option<Arc<dyn PhysicalExpr>>,
) -> Result<Arc<dyn PhysicalExpr>> {
Ok(Arc::new(CaseExpr::try_new(expr, when_thens, else_expr)?))
}
```
function the way it is done with `BinaryExpr` and `binary_cast`
https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/physical_plan/expressions/binary.rs#L1106-L1114
But this is better than master so 👍
--
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