mishop-15 commented on code in PR #20221:
URL: https://github.com/apache/datafusion/pull/20221#discussion_r2806191699
##########
datafusion/functions/src/datetime/date_bin.rs:
##########
@@ -295,7 +295,7 @@ impl ScalarUDFImpl for DateBinFunc {
const NANOS_PER_MICRO: i64 = 1_000;
const NANOS_PER_MILLI: i64 = 1_000_000;
const NANOS_PER_SEC: i64 = NANOSECONDS;
-
+type BinFunction = fn(i64, i64, i64) -> Result<i64>;
Review Comment:
Added comments explaining the arguments and return value.
##########
datafusion/functions/src/datetime/date_bin.rs:
##########
@@ -715,14 +774,20 @@ fn date_bin_impl(
);
}
let array = array.as_primitive::<Time64MicrosecondType>();
- let apply_stride_fn = move |x: i64| {
- let binned_nanos = stride_fn(stride, x *
NANOS_PER_MICRO, origin);
- let nanos = binned_nanos % (NANOSECONDS_IN_DAY);
- nanos / NANOS_PER_MICRO
- };
- let array: PrimitiveArray<Time64MicrosecondType> =
- array.unary(apply_stride_fn);
- ColumnarValue::Array(Arc::new(array))
+ let result: PrimitiveArray<Time64MicrosecondType> = array
Review Comment:
Switched to try_unary, thanks for pointing that out!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]