alamb opened a new issue, #9337:
URL: https://github.com/apache/arrow-rs/issues/9337

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   In DataFusion we have occasions where we have a chrono `NiaveDateTime` or 
`DateTime` and would like to create the corresponding `Timestamp` value (e.g. 
i64)
   
   This came up recently in 
https://github.com/apache/datafusion/pull/19733/changes#r2742968186\\
   
   Basically we want the API
   ```rust
   fn date_to_scalar(date: NaiveDate, target_type: &DataType) -> 
Option<ScalarValue> {
   ```
   
   We have `Date32Type::from_naive_date(date)` but  couldn't find the 
equivalent of Timestamp types as well
   
   I was hoping for something like `TimestampSecondType::from_datetime` or 
something but all I could find was
   
   
https://docs.rs/arrow/latest/arrow/array/types/struct.TimestampSecondType.html 
and https://docs.rs/arrow/latest/arrow/datatypes/trait.ArrowTimestampType.html
   
   Instead we went with our own date/time parsing (see 
https://github.com/apache/datafusion/pull/19733)
   
   
   **Describe the solution you'd like**
   Add an API so downstream crates can avoid having to do date/time/timestamp 
arithmetic to convert from a NiaveDate (or document the conversion better)
   
   **Describe alternatives you've considered**
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   


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