2010YOUY01 commented on code in PR #7752:
URL: https://github.com/apache/arrow-datafusion/pull/7752#discussion_r1358961627
##########
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:
Sounds great 👍🏼 My plan is
1st PR: `impl ScalarFunctionDef for BuiltinScalarFunction` and replace the
execution code with the new interface. This step makes sure the new interface
can cover all functionalities, and determines how the interface looks like
2nd PR: replace current UDF impl with the new interface
3rd and after: start porting existing functions
--
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]