comphead commented on code in PR #2996:
URL: https://github.com/apache/arrow-rs/pull/2996#discussion_r1012282650
##########
arrow/src/compute/kernels/temporal.rs:
##########
@@ -717,49 +674,65 @@ where
T: ArrowTemporalType + ArrowNumericType,
i64: From<T::Native>,
{
- second_generic::<T, _>(array)
+ time_fraction_generic::<T, _, _>(array, "second", |t| t.second() as i32)
}
-/// Extracts the seconds of a given temporal array as an array of integers
-pub fn second_generic<T, A: ArrayAccessor<Item = T::Native>>(
+/// Extracts the nanoseconds of a given temporal primitive array as an array
of integers
+pub fn nanosecond<T>(array: &PrimitiveArray<T>) -> Result<Int32Array>
+where
+ T: ArrowTemporalType + ArrowNumericType,
+ i64: From<T::Native>,
+{
+ time_fraction_generic::<T, _, _>(array, "nanosecond", |t| t.nanosecond()
as i32)
+}
+
+/// Extracts the time fraction of a given temporal array as an array of
integers
+pub fn time_fraction_generic<T, A: ArrayAccessor<Item = T::Native>, F>(
Review Comment:
Made private. Returned public `second_generic` and `minute_generic` methods
as well as tests for them.
--
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]