alamb commented on code in PR #8039:
URL: https://github.com/apache/arrow-datafusion/pull/8039#discussion_r1380760543
##########
datafusion/expr/src/udf.rs:
##########
@@ -89,4 +97,23 @@ impl ScalarUDF {
pub fn call(&self, args: Vec<Expr>) -> Expr {
Expr::ScalarUDF(crate::expr::ScalarUDF::new(Arc::new(self.clone()),
args))
}
+
+ /// Returns this function's name
+ pub fn name(&self) -> &str {
+ &self.name
+ }
+ /// Returns this function's signature
+ pub fn signature(&self) -> &Signature {
+ &self.signature
+ }
+ /// return the return type of this function given the types of the
arguments
+ pub fn return_type(&self, args: &[DataType]) -> Result<DataType> {
Review Comment:
Rather than expose the underlying function pointer directly, I opted to
handle the nuance of calling it here.
##########
datafusion/expr/src/udf.rs:
##########
@@ -15,23 +15,31 @@
// specific language governing permissions and limitations
// under the License.
-//! Udf module contains foundational types that are used to represent UDFs in
DataFusion.
+//! [`ScalarUDF`]: Scalar User Defined Functions
use crate::{Expr, ReturnTypeFunction, ScalarFunctionImplementation, Signature};
+use arrow::datatypes::DataType;
+use datafusion_common::Result;
use std::fmt;
use std::fmt::Debug;
use std::fmt::Formatter;
use std::sync::Arc;
-/// Logical representation of a UDF.
+/// Logical representation of a Scalar User Defined Function.
+///
+/// A scalar function produces a single row output for each row of input.
+///
+/// This struct contains the information DataFusion needs to plan and invoke
+/// functions such name, type signature, return type, and actual
implementation.
+///
#[derive(Clone)]
pub struct ScalarUDF {
- /// name
- pub name: String,
Review Comment:
the key change in this PR is to remove `pub`
--
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]