Skip to content

Commit 6a954b2

Browse files
committed
fix: mark ScalarUDFImpl::invoke_batch as deprecated
should use invoke_with_args instead See apache#14123 (comment)
1 parent da42933 commit 6a954b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

datafusion/expr/src/udf.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,13 @@ impl ScalarUDF {
225225
self.inner.is_nullable(args, schema)
226226
}
227227

228+
#[deprecated(since = "46.0.0", note = "Use `invoke_with_args` instead")]
228229
pub fn invoke_batch(
229230
&self,
230231
args: &[ColumnarValue],
231232
number_rows: usize,
232233
) -> Result<ColumnarValue> {
234+
#[allow(deprecated)]
233235
self.inner.invoke_batch(args, number_rows)
234236
}
235237

@@ -244,15 +246,15 @@ impl ScalarUDF {
244246
///
245247
/// Note: This method is deprecated and will be removed in future releases.
246248
/// User defined functions should implement [`Self::invoke_with_args`] instead.
247-
#[deprecated(since = "42.1.0", note = "Use `invoke_batch` instead")]
249+
#[deprecated(since = "42.1.0", note = "Use `invoke_with_args` instead")]
248250
pub fn invoke_no_args(&self, number_rows: usize) -> Result<ColumnarValue> {
249251
#[allow(deprecated)]
250252
self.inner.invoke_no_args(number_rows)
251253
}
252254

253255
/// Returns a `ScalarFunctionImplementation` that can invoke the function
254256
/// during execution
255-
#[deprecated(since = "42.0.0", note = "Use `invoke_batch` instead")]
257+
#[deprecated(since = "42.0.0", note = "Use `invoke_with_args` instead")]
256258
pub fn fun(&self) -> ScalarFunctionImplementation {
257259
let captured = Arc::clone(&self.inner);
258260
#[allow(deprecated)]
@@ -613,6 +615,7 @@ pub trait ScalarUDFImpl: Debug + Send + Sync {
613615
/// User defined functions should implement [`Self::invoke_with_args`] instead.
614616
///
615617
/// See <https://github.com/apache/datafusion/issues/13515> for more details.
618+
#[deprecated(since = "46.0.0", note = "Use `invoke_with_args` instead")]
616619
fn invoke_batch(
617620
&self,
618621
args: &[ColumnarValue],
@@ -643,6 +646,7 @@ pub trait ScalarUDFImpl: Debug + Send + Sync {
643646
/// [`ColumnarValue::values_to_arrays`] can be used to convert the arguments
644647
/// to arrays, which will likely be simpler code, but be slower.
645648
fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue> {
649+
#[allow(deprecated)]
646650
self.invoke_batch(&args.args, args.number_rows)
647651
}
648652

0 commit comments

Comments
 (0)