pitrou commented on a change in pull request #11328:
URL: https://github.com/apache/arrow/pull/11328#discussion_r744879899



##########
File path: cpp/src/arrow/compute/kernels/scalar_cast_test.cc
##########
@@ -1547,8 +1547,77 @@ TEST(Cast, TimestampToString) {
     CheckCast(
         ArrayFromJSON(timestamp(TimeUnit::SECOND), "[-30610224000, 
-5364662400]"),
         ArrayFromJSON(string_type, R"(["1000-01-01 00:00:00", "1800-01-01 
00:00:00"])"));
+
+    CheckCast(
+        ArrayFromJSON(timestamp(TimeUnit::MILLI), "[-30610224000000, 
-5364662400000]"),
+        ArrayFromJSON(string_type,
+                      R"(["1000-01-01 00:00:00.000", "1800-01-01 
00:00:00.000"])"));
+
+    CheckCast(
+        ArrayFromJSON(timestamp(TimeUnit::MICRO),
+                      "[-30610224000000000, -5364662400000000]"),
+        ArrayFromJSON(string_type,
+                      R"(["1000-01-01 00:00:00.000000", "1800-01-01 
00:00:00.000000"])"));
+
+    CheckCast(
+        ArrayFromJSON(timestamp(TimeUnit::NANO),
+                      "[-596933876543210988, 349837323456789012]"),
+        ArrayFromJSON(
+            string_type,
+            R"(["1951-02-01 01:02:03.456789012", "1981-02-01 
01:02:03.456789012"])"));
+  }
+}
+
+#ifndef _WIN32
+TEST(Cast, TimestampWithZoneToString) {
+  for (auto string_type : {utf8(), large_utf8()}) {
+    CheckCast(
+        ArrayFromJSON(timestamp(TimeUnit::SECOND, "UTC"), "[-30610224000, 
-5364662400]"),
+        ArrayFromJSON(string_type,
+                      R"(["1000-01-01 00:00:00+0000", "1800-01-01 
00:00:00+0000"])"));

Review comment:
       Shouldn't it be "Z" rather than "+0000" for UTC timestamps? 
   See Wikipedia: 
https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)




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