You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/03 07:55:34 UTC

[GitHub] [arrow-rs] Ted-Jiang commented on a change in pull request #1388: Add extract month and day in temporal.rs

Ted-Jiang commented on a change in pull request #1388:
URL: https://github.com/apache/arrow-rs/pull/1388#discussion_r818396029



##########
File path: arrow/src/compute/kernels/temporal.rs
##########
@@ -169,6 +169,23 @@ where
     Ok(b.finish())
 }
 
+/// Extracts the month of a given temporal array as an array of integers
+pub fn month<T>(array: &PrimitiveArray<T>) -> Result<Int32Array>
+where
+    T: ArrowTemporalType + ArrowNumericType,
+    i64: std::convert::From<T::Native>,
+{
+    let mut b = Int32Builder::new(array.len());
+    match array.data_type() {
+        &DataType::Date32 | &DataType::Date64 | &DataType::Timestamp(_, _) => {
+            extract_component_from_array!(array, b, month, value_as_datetime)

Review comment:
       Already add timezone support




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org