2010YOUY01 commented on code in PR #7752:
URL: https://github.com/apache/arrow-datafusion/pull/7752#discussion_r1349567645
##########
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 {
Review Comment:
I think using a trait to define functions is more clear and easy to use, if
extending `ScalarUDF`, then we must init a struct for each function in an
imperative way, it can get messy if there are a lot of function packages to
manage.
And `trait ScalarFunctionDef` should be equivalent to `ScalarUDF` and
`BuitInScalarFunction`, it's possible to replace all with `ScalarFunctionDef`
in the future
(I also updated a more detailed answer for this concern in the original PR
rationale part)
--
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]