@@ -320,46 +320,46 @@ fn date_bin_impl(
320
320
origin : i64 ,
321
321
stride : i64 ,
322
322
stride_fn : fn ( i64 , i64 , i64 ) -> i64 ,
323
- ) -> impl Fn ( Option < i64 > ) -> Option < i64 > {
323
+ ) -> impl Fn ( i64 ) -> i64 {
324
324
let scale = match T :: UNIT {
325
325
Nanosecond => 1 ,
326
326
Microsecond => NANOSECONDS / 1_000_000 ,
327
327
Millisecond => NANOSECONDS / 1_000 ,
328
328
Second => NANOSECONDS ,
329
329
} ;
330
- move |x : Option < i64 > | x . map ( |x| stride_fn ( stride, x * scale, origin) / scale)
330
+ move |x : i64 | stride_fn ( stride, x * scale, origin) / scale
331
331
}
332
332
333
333
Ok ( match array {
334
334
ColumnarValue :: Scalar ( ScalarValue :: TimestampNanosecond ( v, tz_opt) ) => {
335
335
let apply_stride_fn =
336
336
stride_map_fn :: < TimestampNanosecondType > ( origin, stride, stride_fn) ;
337
337
ColumnarValue :: Scalar ( ScalarValue :: TimestampNanosecond (
338
- apply_stride_fn ( * v ) ,
338
+ v . map ( apply_stride_fn ) ,
339
339
tz_opt. clone ( ) ,
340
340
) )
341
341
}
342
342
ColumnarValue :: Scalar ( ScalarValue :: TimestampMicrosecond ( v, tz_opt) ) => {
343
343
let apply_stride_fn =
344
344
stride_map_fn :: < TimestampMicrosecondType > ( origin, stride, stride_fn) ;
345
345
ColumnarValue :: Scalar ( ScalarValue :: TimestampMicrosecond (
346
- apply_stride_fn ( * v ) ,
346
+ v . map ( apply_stride_fn ) ,
347
347
tz_opt. clone ( ) ,
348
348
) )
349
349
}
350
350
ColumnarValue :: Scalar ( ScalarValue :: TimestampMillisecond ( v, tz_opt) ) => {
351
351
let apply_stride_fn =
352
352
stride_map_fn :: < TimestampMillisecondType > ( origin, stride, stride_fn) ;
353
353
ColumnarValue :: Scalar ( ScalarValue :: TimestampMillisecond (
354
- apply_stride_fn ( * v ) ,
354
+ v . map ( apply_stride_fn ) ,
355
355
tz_opt. clone ( ) ,
356
356
) )
357
357
}
358
358
ColumnarValue :: Scalar ( ScalarValue :: TimestampSecond ( v, tz_opt) ) => {
359
359
let apply_stride_fn =
360
360
stride_map_fn :: < TimestampSecondType > ( origin, stride, stride_fn) ;
361
361
ColumnarValue :: Scalar ( ScalarValue :: TimestampSecond (
362
- apply_stride_fn ( * v ) ,
362
+ v . map ( apply_stride_fn ) ,
363
363
tz_opt. clone ( ) ,
364
364
) )
365
365
}
@@ -377,14 +377,13 @@ fn date_bin_impl(
377
377
{
378
378
let array = as_primitive_array :: < T > ( array) ?;
379
379
let apply_stride_fn = stride_map_fn :: < T > ( origin, stride, stride_fn) ;
380
- let array = array
381
- . iter ( )
382
- . map ( apply_stride_fn)
383
- . collect :: < PrimitiveArray < T > > ( )
380
+ let array: PrimitiveArray < T > = array
381
+ . unary ( apply_stride_fn)
384
382
. with_timezone_opt ( tz_opt. clone ( ) ) ;
385
383
386
384
Ok ( ColumnarValue :: Array ( Arc :: new ( array) ) )
387
385
}
386
+
388
387
match array. data_type ( ) {
389
388
Timestamp ( Nanosecond , tz_opt) => {
390
389
transform_array_with_stride :: < TimestampNanosecondType > (
0 commit comments