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 2021/11/25 11:43:42 UTC
[GitHub] [arrow-datafusion] liukun4515 edited a comment on issue #1356: The framework about expression type coercion
liukun4515 edited a comment on issue #1356:
URL: https://github.com/apache/arrow-datafusion/issues/1356#issuecomment-977915679
By the way, I think there is a [bug](https://github.com/apache/arrow-datafusion/blob/645a7f484435d7182d88a541ac8cdf8b079b7714/datafusion/src/physical_plan/aggregates.rs#L138) and #1358
```
let name = name.into();
let arg = coerce(args, input_schema, &signature(fun))?;
if arg.is_empty() {
return Err(DataFusionError::Plan(format!(
"Invalid or wrong number of arguments passed to aggregate: '{}'",
name,
)));
}
let arg = arg[0].clone();
let arg_types = args
.iter()
.map(|e| e.data_type(input_schema))
.collect::<Result<Vec<_>>>()?;
let return_type = return_type(fun, &arg_types)?;
```
The `args` is the original physical exprs, and the `arg` is the coerced physical exprs.
In order to get the result type, we need replace
```
let arg_types = args
.iter()
.map(|e| e.data_type(input_schema))
.collect::<Result<Vec<_>>>()?;
```
with
```
let arg_types = arg
.iter()
.map(|e| e.data_type(input_schema))
.collect::<Result<Vec<_>>>()?;
```
In the [functions.rs](https://github.com/apache/arrow-datafusion/blob/645a7f484435d7182d88a541ac8cdf8b079b7714/datafusion/src/physical_plan/functions.rs#L1139), I think the usage is right.
--
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