Skip to content

Commit

Permalink
Deprecate ScalarUDF::invoke and invoke_no_args for invoke_batch
Browse files Browse the repository at this point in the history
`invoke_batch` is the one used now. The others are no longer in use and
we should deprecate and remove them.
  • Loading branch information
findepi committed Oct 30, 2024
1 parent 223bb02 commit b4cb220
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datafusion/expr/src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ impl ScalarUDF {
/// Invoke the function on `args`, returning the appropriate result.
///
/// See [`ScalarUDFImpl::invoke`] for more details.
#[deprecated(since = "42.1.0", note = "Use `invoke_batch` instead")]
pub fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> {
self.inner.invoke(args)
}
Expand All @@ -215,13 +216,14 @@ impl ScalarUDF {
/// Invoke the function without `args` but number of rows, returning the appropriate result.
///
/// See [`ScalarUDFImpl::invoke_no_args`] for more details.
#[deprecated(since = "42.1.0", note = "Use `invoke_batch` instead")]
pub fn invoke_no_args(&self, number_rows: usize) -> Result<ColumnarValue> {
self.inner.invoke_no_args(number_rows)
}

/// Returns a `ScalarFunctionImplementation` that can invoke the function
/// during execution
#[deprecated(since = "42.0.0", note = "Use `invoke` or `invoke_no_args` instead")]
#[deprecated(since = "42.0.0", note = "Use `invoke_batch` instead")]
pub fn fun(&self) -> ScalarFunctionImplementation {
let captured = Arc::clone(&self.inner);
Arc::new(move |args| captured.invoke(args))
Expand Down

0 comments on commit b4cb220

Please sign in to comment.