alamb opened a new issue, #8568: URL: https://github.com/apache/arrow-datafusion/issues/8568
### Is your feature request related to a problem or challenge? The current way a user implements a [ScalarUDF](https://docs.rs/datafusion/latest/datafusion/physical_plan/udf/struct.ScalarUDF.html#) is awkward: They must wade through several `Arc<dyn<...>` typedefs to figure out how to provide the type signature and implementation ```rust pub fn new( name: &str, signature: &Signature, return_type: &Arc<dyn Fn(&[DataType]) -> Result<Arc<DataType>, DataFusionError> + Send + Sync>, fun: &Arc<dyn Fn(&[ColumnarValue]) -> Result<ColumnarValue, DataFusionError> + Send + Sync> ) -> ScalarUDF ``` The [create_udf](https://docs.rs/datafusion/latest/datafusion/logical_expr/expr_fn/fn.create_udf.html#) is somewhat easier to use, but it still requires Arc's of anonymous functions ### Describe the solution you'd like I am not sure why this API is implemented like it is. If I were a user I would expect to be able to use a trait object like ```rust struct MyUDF { .. } impl FunctionDefintion for MyUDF { fn name(&self) -> &str, fn return_type(&self) -> &DataType, ... } ``` ### Describe alternatives you've considered _No response_ ### Additional context _No response_ -- 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]
