alamb commented on a change in pull request #832:
URL: https://github.com/apache/arrow-rs/pull/832#discussion_r731719828



##########
File path: arrow/src/csv/reader.rs
##########
@@ -1371,6 +1372,98 @@ mod tests {
         );
     }
 
+    /// 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",
+                stringify! { naive_datetime }

Review comment:
       I don't think this `stringify` is needed here: it converts 
`naive_datetime` into the string -- so this message always looks like:
   
   ```
   thread 'main' panicked at 'Unexpected failure converting naive_datetime to 
local datetime', src/main.rs:2:3
   ```
   Which you can see at the playground:  
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9f6fbabade9152946ea5a84db486c2de
   
   Since it is in test code, this is likely not a critical problem but I 
noticed it so figured I would point it out




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