alamb commented on issue #8624:
URL: 
https://github.com/apache/arrow-datafusion/issues/8624#issuecomment-1908178559

   Thanks @yyy1000  -- FYI aware this is likely to be an exercise in careful 
API design
   
   Perhaps you could look into extending `ScalarFunctionImpl` 
https://github.com/apache/arrow-datafusion/blob/bc0ba6a724aaaf312b770451718cbce696de6640/datafusion/expr/src/udf.rs#L237
 in backwards compatible way
   
   For example:
   
   ```rust
   trait ScalarUDFImpl { 
   ...
   
       /// What [`DataType`] will be returned by this function, given the types 
of
       /// the expr arguments
       fn return_type_from_exprs(&self, arg_exprs: &[Expr], schema: &SchemaRef) 
-> Result<DataType> {
        // provide default implementation that calls `self.return_type()`
        // so that people don't have to implement `return_type_from_exprs` if 
they dont want to
       }
    ...
   }
   ```
   
   An exellent test of the new API would be to see if you can implement 
`arrow_cast` as a `ScalarUDF` we can put it into `datafusion-functions` after 
https://github.com/apache/arrow-datafusion/pull/8705 is merged
   


-- 
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]

Reply via email to