viirya commented on code in PR #2623:
URL: https://github.com/apache/arrow-rs/pull/2623#discussion_r964103198
##########
arrow/src/compute/kernels/temporal.rs:
##########
@@ -171,335 +172,747 @@ pub fn using_chrono_tz_and_utc_naive_date_time(
.ok()
}
-/// Extracts the hours of a given temporal array as an array of integers
+/// Extracts the hours of a given temporal primitive array as an array of
integers
pub fn hour<T>(array: &PrimitiveArray<T>) -> Result<Int32Array>
+where
+ T: ArrowTemporalType + ArrowNumericType,
+ i64: std::convert::From<T::Native>,
+{
+ hour_generic::<T, _>(array)
+}
+
+/// Extracts the hours of a given temporal array as an array of integers
+pub fn hour_generic<T, A: ArrayAccessor<Item = T::Native>>(array: A) ->
Result<Int32Array>
Review Comment:
Please see
https://github.com/apache/arrow-rs/pull/2623#discussion_r961346254. I began
with a generic version of `hour` to replace existing one. But it will be loss
of automatic type hinting as we always need to specify at least `T` when
calling the generic `hour`. Seems a step back ergonomically for the common
case.
So currently I provide a generic version and keep original `hour` signature
untouched.
--
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]