novemberkilo commented on a change in pull request #849:
URL: https://github.com/apache/arrow-rs/pull/849#discussion_r748716065



##########
File path: arrow/src/csv/writer.rs
##########
@@ -626,6 +787,134 @@ sed do eiusmod 
tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03,\n";
         assert_eq!(Some(left.to_string()), right.ok());
     }
 
+    #[cfg(feature = "chrono-tz")]
+    #[test]
+    fn test_export_csv_timestamps() {
+        let schema = Schema::new(vec![
+            Field::new(
+                "c1",
+                DataType::Timestamp(
+                    TimeUnit::Millisecond,
+                    Some("Australia/Sydney".to_string()),
+                ),
+                true,
+            ),
+            Field::new("c2", DataType::Timestamp(TimeUnit::Millisecond, None), 
true),
+        ]);
+
+        let c1 = TimestampMillisecondArray::from_opt_vec(
+            // 1555584887 converts to 2019-04-18, 20:54:47 in time zone 
Australia/Sydney (AEST).
+            // The offset (difference to UTC) is +10:00.
+            // 1635577147 converts to 2021-10-30 17:59:07 in time zone 
Australia/Sydney (AEDT)
+            // The offset (difference to UTC) is +11:00. Note that daylight 
savings is in effect on 2021-10-30.
+            //
+            vec![Some(1555584887378), Some(1635577147000)],
+            Some("Australia/Sydney".to_string()),
+        );
+        let c2 = TimestampMillisecondArray::from_opt_vec(
+            vec![Some(1555584887378), Some(1635577147000)],
+            None,
+        );
+        let batch =
+            RecordBatch::try_new(Arc::new(schema), vec![Arc::new(c1), 
Arc::new(c2)])
+                .unwrap();
+
+        let sw = StringWriter::new();
+        let mut writer = Writer::new(sw);
+        let batches = vec![&batch];
+        for batch in batches {
+            writer.write(batch).unwrap();
+        }
+
+        let left = "c1,c2
+2019-04-18T20:54:47.378000000+10:00,2019-04-18T10:54:47.378000000Z
+2021-10-30T17:59:07.000000000+11:00,2021-10-30T06:59:07.000000000Z\n";
+        let right = writer.writer.into_inner().map(|s| s.to_string());
+        assert_eq!(Some(left.to_string()), right.ok());
+    }
+
+    #[cfg(feature = "chrono-tz")]
+    #[test]
+    fn test_export_csv_string() {

Review comment:
       Good point thanks - removing.




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