kszucs commented on a change in pull request #10457:
URL: https://github.com/apache/arrow/pull/10457#discussion_r657533421



##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
##########
@@ -143,39 +142,204 @@ TEST(ScalarTemporalTest, 
TestTemporalComponentExtractionWithDifferentUnits) {
     CheckScalarUnary("quarter", unit, times, int64(), quarter);
     CheckScalarUnary("hour", unit, times, int64(), hour);
     CheckScalarUnary("minute", unit, times, int64(), minute);
-    CheckScalarUnary("second", unit, times, float64(), second);
+    CheckScalarUnary("second", unit, times, int64(), second);
     CheckScalarUnary("millisecond", unit, times, int64(), zeros);
     CheckScalarUnary("microsecond", unit, times, int64(), zeros);
     CheckScalarUnary("nanosecond", unit, times, int64(), zeros);
     CheckScalarUnary("subsecond", unit, times, float64(), zeros);
   }
 }
 
-TEST(ScalarTemporalTest, TestZonedTemporalComponentExtraction) {
-  std::string timezone = "Asia/Kolkata";
-  const char* times = R"(["1970-01-01T00:00:59", null])";
+TEST(ScalarTemporalTest, TestOutsideNanosecondRange) {
+  const char* times = R"(["1677-09-20T00:00:59.123456", 
"2262-04-13T23:23:23.999999"])";
 
-  for (auto u : internal::AllTimeUnits()) {
-    auto unit = timestamp(u, timezone);
-    auto timestamps = ArrayFromJSON(unit, times);
-
-    ASSERT_RAISES(NotImplemented, Year(timestamps));
-    ASSERT_RAISES(NotImplemented, Month(timestamps));
-    ASSERT_RAISES(NotImplemented, Day(timestamps));
-    ASSERT_RAISES(NotImplemented, DayOfWeek(timestamps));
-    ASSERT_RAISES(NotImplemented, DayOfYear(timestamps));
-    ASSERT_RAISES(NotImplemented, ISOYear(timestamps));
-    ASSERT_RAISES(NotImplemented, ISOWeek(timestamps));
-    ASSERT_RAISES(NotImplemented, ISOCalendar(timestamps));
-    ASSERT_RAISES(NotImplemented, Quarter(timestamps));
-    ASSERT_RAISES(NotImplemented, Hour(timestamps));
-    ASSERT_RAISES(NotImplemented, Minute(timestamps));
-    ASSERT_RAISES(NotImplemented, Second(timestamps));
-    ASSERT_RAISES(NotImplemented, Millisecond(timestamps));
-    ASSERT_RAISES(NotImplemented, Microsecond(timestamps));
-    ASSERT_RAISES(NotImplemented, Nanosecond(timestamps));
-    ASSERT_RAISES(NotImplemented, Subsecond(timestamps));
-  }
+  auto unit = timestamp(TimeUnit::MICRO);
+  auto iso_calendar_type =
+      struct_({field("iso_year", int64()), field("iso_week", int64()),
+               field("iso_day_of_week", int64())});
+
+  auto year = "[1677, 2262]";
+  auto month = "[9, 4]";
+  auto day = "[20, 13]";
+  auto day_of_week = "[0, 6]";
+  auto day_of_year = "[263, 103]";
+  auto iso_year = "[1677, 2262]";
+  auto iso_week = "[38, 15]";
+  auto iso_calendar =
+      ArrayFromJSON(iso_calendar_type,
+                    R"([{"iso_year": 1677, "iso_week": 38, "iso_day_of_week": 
1},
+                          {"iso_year": 2262, "iso_week": 15, 
"iso_day_of_week": 7}])");
+  auto quarter = "[3, 2]";
+  auto hour = "[0, 23]";
+  auto minute = "[0, 23]";
+  auto second = "[59, 23]";
+  auto millisecond = "[123, 999]";
+  auto microsecond = "[456, 999]";
+  auto nanosecond = "[0, 0]";
+  auto subsecond = "[0.123456, 0.999999]";
+
+  CheckScalarUnary("year", unit, times, int64(), year);
+  CheckScalarUnary("month", unit, times, int64(), month);
+  CheckScalarUnary("day", unit, times, int64(), day);
+  CheckScalarUnary("day_of_week", unit, times, int64(), day_of_week);
+  CheckScalarUnary("day_of_year", unit, times, int64(), day_of_year);
+  CheckScalarUnary("iso_year", unit, times, int64(), iso_year);
+  CheckScalarUnary("iso_week", unit, times, int64(), iso_week);
+  CheckScalarUnary("iso_calendar", ArrayFromJSON(unit, times), iso_calendar);
+  CheckScalarUnary("quarter", unit, times, int64(), quarter);
+  CheckScalarUnary("hour", unit, times, int64(), hour);
+  CheckScalarUnary("minute", unit, times, int64(), minute);
+  CheckScalarUnary("second", unit, times, int64(), second);
+  CheckScalarUnary("millisecond", unit, times, int64(), millisecond);
+  CheckScalarUnary("microsecond", unit, times, int64(), microsecond);
+  CheckScalarUnary("nanosecond", unit, times, int64(), nanosecond);
+  CheckScalarUnary("subsecond", unit, times, float64(), subsecond);
+}
+
+#ifndef _WIN32

Review comment:
       I may misunderstand, but currently we don't have a folder which we 
bundle with the C++ libraries, though we could certainly bundle certain files 
into the binaries. 
   




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to