alamb commented on issue #587:
URL: https://github.com/apache/arrow-rs/issues/587#issuecomment-893079145


   Thanks @sum12 !  think the trait you want is `ArrowTemporalType` 
https://docs.rs/arrow/5.1.0/arrow/datatypes/trait.ArrowTemporalType.html
   
   So then you could write a function like:
   
   ```rust
   fn temporal_array_to_string<T>(array: &PrimitiveArray<T>) -> Result<ArrayRef>
   where
       T: ArrowTemporalType,
   {
     //  ... call array.value_as_datetime  here as appropriate
   }
   ```
   
   And then to call it you might do something like:
   ```rust
   let timestamp_array = 
array.as_any().downcast_ref::<TimestampNanosecondArray>().unwrap();
   temporal_array_to_string(timestamp_array)
   ```
   
   


-- 
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]


Reply via email to