jorisvandenbossche commented on a change in pull request #12215:
URL: https://github.com/apache/arrow/pull/12215#discussion_r811681158



##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
##########
@@ -1455,6 +1455,35 @@ TEST_F(ScalarTemporalTest, TestTemporalSubtractDuration) 
{
   }
 }
 
+TEST_F(ScalarTemporalTest, TestTemporalMultiplyDuration) {
+  std::shared_ptr<Array> max_array;
+  auto max = std::numeric_limits<int64_t>::max();
+  ArrayFromVector<Int64Type, int64_t>({max, max, max, max}, &max_array);
+
+  for (auto u : TimeUnit::values()) {
+    auto unit = duration(u);
+    auto durations = ArrayFromJSON(unit, R"([0, 1, 6, null])");
+    auto multipliers = ArrayFromJSON(int64(), R"([0, 3, 7, null])");
+    auto durations_multiplied = ArrayFromJSON(unit, R"([0, 3, 42, null])");
+
+    CheckScalarBinary("multiply", durations, multipliers, 
durations_multiplied);
+    CheckScalarBinary("multiply_checked", durations, multipliers, 
durations_multiplied);
+    EXPECT_RAISES_WITH_MESSAGE_THAT(
+        Invalid, ::testing::HasSubstr("Invalid: overflow"),
+        CallFunction("multiply_checked", {durations, max_array}));
+  }
+}
+
+TEST_F(ScalarTemporalTest, TestTemporalDivideDuration) {
+  for (auto u : TimeUnit::values()) {
+    auto unit = duration(u);
+    auto durations = ArrayFromJSON(unit, R"([1, 6, null])");
+    auto multipliers = ArrayFromJSON(int64(), R"([3, 7, null])");
+    auto durations_multiplied = ArrayFromJSON(unit, R"([3, 42, null])");

Review comment:
       Can you have a case in this test where the division is not exact?




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