alamb commented on code in PR #8985:
URL: https://github.com/apache/arrow-datafusion/pull/8985#discussion_r1486496397
##########
datafusion/physical-expr/src/udf.rs:
##########
@@ -38,7 +38,7 @@ pub fn create_physical_expr(
fun.name(),
fun.fun(),
input_phy_exprs.to_vec(),
- fun.return_type(&input_exprs_types)?,
+ fun.return_type_from_exprs(&input_phy_exprs, input_schema)?,
Review Comment:
It isn't possible in general to go from physical expressions back to Exprs.
I recommend adding a `return_type` argument to this function and thus
require the caller to pass it in.
I believe the caller of `udf::create_physical_expr` has this information:
```rust
/// Create a physical expression of the UDF.
///
/// Note that the return type must match the type reported by fun
pub fn create_physical_expr(
fun: &ScalarUDF,
input_phy_exprs: &[Arc<dyn PhysicalExpr>],
return_type: DataType,
) -> Result<Arc<dyn PhysicalExpr>> {
```
--
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]