waitingkuo commented on issue #765:
URL: 
https://github.com/apache/arrow-datafusion/issues/765#issuecomment-1263693645

   this is the offset comes from
   
   
https://github.com/apache/arrow-rs/blob/master/arrow/src/compute/kernels/cast_utils.rs#L205-L220
   ```rust
       /// Interprets a naive_datetime (with no explicit timezone offset)
       /// using the local timezone and returns the timestamp in UTC (0
       /// offset)
       fn naive_datetime_to_timestamp(naive_datetime: &NaiveDateTime) -> i64 {
           // Note: Use chrono APIs that are different than
           // naive_datetime_to_timestamp to compute the utc offset to
           // try and double check the logic
           let utc_offset_secs = match 
Local.offset_from_local_datetime(naive_datetime) {
               LocalResult::Single(local_offset) => {
                   local_offset.fix().local_minus_utc() as i64
               }
               _ => panic!("Unexpected failure converting to local datetime"),
           };
           let utc_offset_nanos = utc_offset_secs * 1_000_000_000;
           naive_datetime.timestamp_nanos() - utc_offset_nanos
       }
   ```
   


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