Skip to content

Commit 132b21f

Browse files
authored
move to invoke_with_args for math function macro (#14690)
1 parent 6d517fd commit 132b21f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

datafusion/functions/src/macros.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ macro_rules! make_math_unary_udf {
164164
use datafusion_expr::interval_arithmetic::Interval;
165165
use datafusion_expr::sort_properties::{ExprProperties, SortProperties};
166166
use datafusion_expr::{
167-
ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
167+
ColumnarValue, Documentation, ScalarFunctionArgs, ScalarUDFImpl,
168+
Signature, Volatility,
168169
};
169170

170171
#[derive(Debug)]
@@ -218,12 +219,11 @@ macro_rules! make_math_unary_udf {
218219
$EVALUATE_BOUNDS(inputs)
219220
}
220221

221-
fn invoke_batch(
222+
fn invoke_with_args(
222223
&self,
223-
args: &[ColumnarValue],
224-
_number_rows: usize,
224+
args: ScalarFunctionArgs,
225225
) -> Result<ColumnarValue> {
226-
let args = ColumnarValue::values_to_arrays(args)?;
226+
let args = ColumnarValue::values_to_arrays(&args.args)?;
227227
let arr: ArrayRef = match args[0].data_type() {
228228
DataType::Float64 => Arc::new(
229229
args[0]
@@ -278,7 +278,8 @@ macro_rules! make_math_binary_udf {
278278
use datafusion_expr::sort_properties::{ExprProperties, SortProperties};
279279
use datafusion_expr::TypeSignature;
280280
use datafusion_expr::{
281-
ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
281+
ColumnarValue, Documentation, ScalarFunctionArgs, ScalarUDFImpl,
282+
Signature, Volatility,
282283
};
283284

284285
#[derive(Debug)]
@@ -330,12 +331,11 @@ macro_rules! make_math_binary_udf {
330331
$OUTPUT_ORDERING(input)
331332
}
332333

333-
fn invoke_batch(
334+
fn invoke_with_args(
334335
&self,
335-
args: &[ColumnarValue],
336-
_number_rows: usize,
336+
args: ScalarFunctionArgs,
337337
) -> Result<ColumnarValue> {
338-
let args = ColumnarValue::values_to_arrays(args)?;
338+
let args = ColumnarValue::values_to_arrays(&args.args)?;
339339
let arr: ArrayRef = match args[0].data_type() {
340340
DataType::Float64 => {
341341
let y = args[0].as_primitive::<Float64Type>();

0 commit comments

Comments
 (0)