snigdhachoppac commented on code in PR #50675:
URL: https://github.com/apache/arrow/pull/50675#discussion_r3663402673


##########
cpp/src/arrow/compute/kernels/scalar_temporal_test.cc:
##########
@@ -3779,6 +3779,86 @@ TEST_F(ScalarTemporalTest, 
TestCeilFloorRoundTemporalDate) {
   CheckScalarUnary("ceil_temporal", arr_ns, arr_ns, &round_to_2_hours);
 }
 
+TEST_F(ScalarTemporalTest, TestCeilFloorRoundTemporalDuration) {
+  auto check_unit = [&](TimeUnit::type time_unit, CalendarUnit calendar_unit) {
+    RoundTemporalOptions round_to_2_units(2, calendar_unit);
+    auto values = ArrayFromJSON(duration(time_unit), "[0, 1, 2, 3, -1, -2, -3, 
null]");
+
+    CheckScalarUnary("ceil_temporal", values,
+                     ArrayFromJSON(duration(time_unit), "[0, 2, 2, 4, 0, -2, 
-2, null]"),
+                     &round_to_2_units);
+    CheckScalarUnary("floor_temporal", values,
+                     ArrayFromJSON(duration(time_unit), "[0, 0, 2, 2, -2, -2, 
-4, null]"),
+                     &round_to_2_units);
+    CheckScalarUnary("round_temporal", values,
+                     ArrayFromJSON(duration(time_unit), "[0, 2, 2, 4, 0, -2, 
-2, null]"),
+                     &round_to_2_units);
+  };
+
+  check_unit(TimeUnit::SECOND, CalendarUnit::SECOND);
+  check_unit(TimeUnit::MILLI, CalendarUnit::MILLISECOND);
+  check_unit(TimeUnit::MICRO, CalendarUnit::MICROSECOND);
+  check_unit(TimeUnit::NANO, CalendarUnit::NANOSECOND);

Review Comment:
   Thanks, I’ll add explicit minute and hour coverage.



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