@@ -234,15 +234,13 @@ mod tests {
234234
235235 #[ test]
236236 fn test_make_date ( ) {
237+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
237238 let res = MakeDateFunc :: new ( )
238- . invoke_batch (
239- & [
240- ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 2024 ) ) ) ,
241- ColumnarValue :: Scalar ( ScalarValue :: Int64 ( Some ( 1 ) ) ) ,
242- ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( 14 ) ) ) ,
243- ] ,
244- 1 ,
245- )
239+ . invoke ( & [
240+ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 2024 ) ) ) ,
241+ ColumnarValue :: Scalar ( ScalarValue :: Int64 ( Some ( 1 ) ) ) ,
242+ ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( 14 ) ) ) ,
243+ ] )
246244 . expect ( "that make_date parsed values without error" ) ;
247245
248246 if let ColumnarValue :: Scalar ( ScalarValue :: Date32 ( date) ) = res {
@@ -251,15 +249,13 @@ mod tests {
251249 panic ! ( "Expected a scalar value" )
252250 }
253251
252+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
254253 let res = MakeDateFunc :: new ( )
255- . invoke_batch (
256- & [
257- ColumnarValue :: Scalar ( ScalarValue :: Int64 ( Some ( 2024 ) ) ) ,
258- ColumnarValue :: Scalar ( ScalarValue :: UInt64 ( Some ( 1 ) ) ) ,
259- ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( 14 ) ) ) ,
260- ] ,
261- 1 ,
262- )
254+ . invoke ( & [
255+ ColumnarValue :: Scalar ( ScalarValue :: Int64 ( Some ( 2024 ) ) ) ,
256+ ColumnarValue :: Scalar ( ScalarValue :: UInt64 ( Some ( 1 ) ) ) ,
257+ ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( 14 ) ) ) ,
258+ ] )
263259 . expect ( "that make_date parsed values without error" ) ;
264260
265261 if let ColumnarValue :: Scalar ( ScalarValue :: Date32 ( date) ) = res {
@@ -268,15 +264,13 @@ mod tests {
268264 panic ! ( "Expected a scalar value" )
269265 }
270266
267+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
271268 let res = MakeDateFunc :: new ( )
272- . invoke_batch (
273- & [
274- ColumnarValue :: Scalar ( ScalarValue :: Utf8 ( Some ( "2024" . to_string ( ) ) ) ) ,
275- ColumnarValue :: Scalar ( ScalarValue :: LargeUtf8 ( Some ( "1" . to_string ( ) ) ) ) ,
276- ColumnarValue :: Scalar ( ScalarValue :: Utf8 ( Some ( "14" . to_string ( ) ) ) ) ,
277- ] ,
278- 1 ,
279- )
269+ . invoke ( & [
270+ ColumnarValue :: Scalar ( ScalarValue :: Utf8 ( Some ( "2024" . to_string ( ) ) ) ) ,
271+ ColumnarValue :: Scalar ( ScalarValue :: LargeUtf8 ( Some ( "1" . to_string ( ) ) ) ) ,
272+ ColumnarValue :: Scalar ( ScalarValue :: Utf8 ( Some ( "14" . to_string ( ) ) ) ) ,
273+ ] )
280274 . expect ( "that make_date parsed values without error" ) ;
281275
282276 if let ColumnarValue :: Scalar ( ScalarValue :: Date32 ( date) ) = res {
@@ -288,16 +282,13 @@ mod tests {
288282 let years = Arc :: new ( ( 2021 ..2025 ) . map ( Some ) . collect :: < Int64Array > ( ) ) ;
289283 let months = Arc :: new ( ( 1 ..5 ) . map ( Some ) . collect :: < Int32Array > ( ) ) ;
290284 let days = Arc :: new ( ( 11 ..15 ) . map ( Some ) . collect :: < UInt32Array > ( ) ) ;
291- let batch_size = years . len ( ) ;
285+ # [ allow ( deprecated ) ] // TODO migrate UDF invoke to invoke_batch
292286 let res = MakeDateFunc :: new ( )
293- . invoke_batch (
294- & [
295- ColumnarValue :: Array ( years) ,
296- ColumnarValue :: Array ( months) ,
297- ColumnarValue :: Array ( days) ,
298- ] ,
299- batch_size,
300- )
287+ . invoke ( & [
288+ ColumnarValue :: Array ( years) ,
289+ ColumnarValue :: Array ( months) ,
290+ ColumnarValue :: Array ( days) ,
291+ ] )
301292 . expect ( "that make_date parsed values without error" ) ;
302293
303294 if let ColumnarValue :: Array ( array) = res {
@@ -317,50 +308,45 @@ mod tests {
317308 //
318309
319310 // invalid number of arguments
311+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
320312 let res = MakeDateFunc :: new ( )
321- . invoke_batch ( & [ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 1 ) ) ) ] , 1 ) ;
313+ . invoke ( & [ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 1 ) ) ) ] ) ;
322314 assert_eq ! (
323315 res. err( ) . unwrap( ) . strip_backtrace( ) ,
324316 "Execution error: make_date function requires 3 arguments, got 1"
325317 ) ;
326318
327319 // invalid type
328- let res = MakeDateFunc :: new ( ) . invoke_batch (
329- & [
330- ColumnarValue :: Scalar ( ScalarValue :: IntervalYearMonth ( Some ( 1 ) ) ) ,
331- ColumnarValue :: Scalar ( ScalarValue :: TimestampNanosecond ( Some ( 1 ) , None ) ) ,
332- ColumnarValue :: Scalar ( ScalarValue :: TimestampNanosecond ( Some ( 1 ) , None ) ) ,
333- ] ,
334- 1 ,
335- ) ;
320+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
321+ let res = MakeDateFunc :: new ( ) . invoke ( & [
322+ ColumnarValue :: Scalar ( ScalarValue :: IntervalYearMonth ( Some ( 1 ) ) ) ,
323+ ColumnarValue :: Scalar ( ScalarValue :: TimestampNanosecond ( Some ( 1 ) , None ) ) ,
324+ ColumnarValue :: Scalar ( ScalarValue :: TimestampNanosecond ( Some ( 1 ) , None ) ) ,
325+ ] ) ;
336326 assert_eq ! (
337327 res. err( ) . unwrap( ) . strip_backtrace( ) ,
338328 "Arrow error: Cast error: Casting from Interval(YearMonth) to Int32 not supported"
339329 ) ;
340330
341331 // overflow of month
342- let res = MakeDateFunc :: new ( ) . invoke_batch (
343- & [
344- ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 2023 ) ) ) ,
345- ColumnarValue :: Scalar ( ScalarValue :: UInt64 ( Some ( u64:: MAX ) ) ) ,
346- ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 22 ) ) ) ,
347- ] ,
348- 1 ,
349- ) ;
332+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
333+ let res = MakeDateFunc :: new ( ) . invoke ( & [
334+ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 2023 ) ) ) ,
335+ ColumnarValue :: Scalar ( ScalarValue :: UInt64 ( Some ( u64:: MAX ) ) ) ,
336+ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 22 ) ) ) ,
337+ ] ) ;
350338 assert_eq ! (
351339 res. err( ) . unwrap( ) . strip_backtrace( ) ,
352340 "Arrow error: Cast error: Can't cast value 18446744073709551615 to type Int32"
353341 ) ;
354342
355343 // overflow of day
356- let res = MakeDateFunc :: new ( ) . invoke_batch (
357- & [
358- ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 2023 ) ) ) ,
359- ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 22 ) ) ) ,
360- ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( u32:: MAX ) ) ) ,
361- ] ,
362- 1 ,
363- ) ;
344+ #[ allow( deprecated) ] // TODO migrate UDF invoke to invoke_batch
345+ let res = MakeDateFunc :: new ( ) . invoke ( & [
346+ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 2023 ) ) ) ,
347+ ColumnarValue :: Scalar ( ScalarValue :: Int32 ( Some ( 22 ) ) ) ,
348+ ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( u32:: MAX ) ) ) ,
349+ ] ) ;
364350 assert_eq ! (
365351 res. err( ) . unwrap( ) . strip_backtrace( ) ,
366352 "Arrow error: Cast error: Can't cast value 4294967295 to type Int32"
0 commit comments