alamb commented on code in PR #7752:
URL: https://github.com/apache/arrow-datafusion/pull/7752#discussion_r1350299242


##########
datafusion/expr/src/udf.rs:
##########
@@ -18,11 +18,30 @@
 //! Udf module contains foundational types that are used to represent UDFs in 
DataFusion.
 
 use crate::{Expr, ReturnTypeFunction, ScalarFunctionImplementation, Signature};
+use arrow::array::ArrayRef;
+use datafusion_common::Result;
 use std::fmt;
 use std::fmt::Debug;
 use std::fmt::Formatter;
 use std::sync::Arc;
 
+pub trait ScalarFunctionDef: Sync + Send + std::fmt::Debug {
+    // TODO: support alias
+    fn name(&self) -> &str;
+
+    fn signature(&self) -> Signature;
+
+    // TODO: ReturnTypeFunction -> a ENUM
+    //     most function's return type is either the same as 1st arg or a 
fixed type
+    fn return_type(&self) -> ReturnTypeFunction;

Review Comment:
   I like that idea -- 
   
   maybe the implementation plan sequence could be:
   1. Introduce `ScalarFunctionDef` 
   2. `impl ScalarFunctionDef` for `ScalarUDF` and `BuiltInFunction`
   3. Update the core DataFusion code to only use `ScalarFunctionDef`
   4. Port all BuiltInFunction to `ScalarFunctionDef`
   5. Deprecate `ScalarFunctionDef` 
   6. Remove `BuiltinFunctionDef`
   
   
   



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