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 2021/10/18 18:15:50 UTC

[GitHub] [arrow-rs] martin-g commented on a change in pull request #832: Use kernel utility for parsing timestamps in csv reader.

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



##########
File path: arrow/src/csv/reader.rs
##########
@@ -1371,6 +1372,95 @@ mod tests {
         );
     }
 
+    /// Interprets a naive_datetime (with no explicit timzone 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"),

Review comment:
       would it be useful to print the naive_datetime for easier debugging ?

##########
File path: arrow/src/csv/reader.rs
##########
@@ -1371,6 +1372,95 @@ mod tests {
         );
     }
 
+    /// Interprets a naive_datetime (with no explicit timzone offset)

Review comment:
       s/timzone/tim`e`zone/




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