You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "waitingkuo (via GitHub)" <gi...@apache.org> on 2023/02/07 19:42:06 UTC

[GitHub] [arrow-rs] waitingkuo commented on a diff in pull request #3673: Support UTF8 cast to Timestamp with timezone

waitingkuo commented on code in PR #3673:
URL: https://github.com/apache/arrow-rs/pull/3673#discussion_r1099121331


##########
arrow-cast/src/cast.rs:
##########
@@ -7833,4 +7836,41 @@ mod tests {
         assert_eq!(v.value(0), 946728000000);
         assert_eq!(v.value(1), 1608035696000);
     }
+
+    #[test]
+    fn test_cast_utf8_to_timestamp() {
+        let valid = StringArray::from(vec![
+            "2023-01-01 04:05:06.789000-08:00",
+            "2023-01-01 04:05:06.789000-07:00",
+            "2023-01-01 04:05:06.789 -0800",
+            "2023-01-01 04:05:06.789 -08:00",
+            "2023-01-01 040506 +0730",
+            "2023-01-01 040506 +07:30",
+            "2023-01-01 04:05:06.789",
+            "2023-01-01 04:05:06",
+            "2023-01-01",
+        ]);
+
+        let array = Arc::new(valid) as ArrayRef;
+        let b = cast(
+            &array,
+            &DataType::Timestamp(TimeUnit::Nanosecond, Some("+00:00".to_string())),

Review Comment:
   👍 
   
   it'd be great if we could add some test cases for casting to non-utc time 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