Skip to content

Commit

Permalink
Add SimpleScalarUDF::new_with_signature
Browse files Browse the repository at this point in the history
This is helpful for simple function implementations or function stubs,
when `Signature::exact` is not desired.
  • Loading branch information
findepi committed Nov 28, 2024
1 parent 5818732 commit 46122b4
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions datafusion/expr/src/expr_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,22 @@ impl SimpleScalarUDF {
volatility: Volatility,
fun: ScalarFunctionImplementation,
) -> Self {
let name = name.into();
let signature = Signature::exact(input_types, volatility);
Self {
Self::new_with_signature(
name,
Signature::exact(input_types, volatility),
return_type,
fun,
)
}

pub fn new_with_signature(
name: impl Into<String>,
signature: Signature,
return_type: DataType,
fun: ScalarFunctionImplementation,
) -> Self {
Self {
name: name.into(),
signature,
return_type,
fun,
Expand Down

0 comments on commit 46122b4

Please sign in to comment.