You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/15 17:04:31 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #12141: ARROW-14100: [C++] subtract(duration, duration) -> duration kernel

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



##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
##########
@@ -1242,6 +1242,21 @@ TEST_F(ScalarTemporalTest, TestTemporalSubtractTimeAndDuration) {
   }
 }
 
+TEST_F(ScalarTemporalTest, TestTemporalSubtractDuration) {
+  for (auto op : {"subtract", "subtract_checked"}) {
+    for (auto u : TimeUnit::values()) {
+      auto unit = duration(u);
+      CheckScalarBinary(op, ArrayFromJSON(unit, times_s2), ArrayFromJSON(unit, times_s),
+                        ArrayFromJSON(unit, seconds_between_time));
+    }
+
+    auto seconds_3 = ArrayFromJSON(duration(TimeUnit::SECOND), R"([3, null])");
+    auto milliseconds_2k = ArrayFromJSON(duration(TimeUnit::MILLI), R"([2000, null])");
+    auto milliseconds_1k = ArrayFromJSON(duration(TimeUnit::MILLI), R"([1000, null])");
+    CheckScalarBinary(op, seconds_3, milliseconds_2k, milliseconds_1k);
+  }
+}

Review comment:
       Can you add tests for overflowing inputs?




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