JonSnow1807 commented on code in PR #55460:
URL: https://github.com/apache/arrow/pull/55460#discussion_r4646226177
##########
python/pyarrow/tests/test_compute.py:
##########
@@ -1941,6 +1941,16 @@ def test_arithmetic_multiply():
assert result.equals(expected)
+def test_arithmetic_multiply_divide_duration_by_float():
+ # Example from GH-48003. Results are truncated toward zero, like numpy.
+ x = pa.array([0, 1, 2, 3, 4, 5], type=pa.duration("s"))
+ half = pa.array([0, 0, 1, 1, 2, 2], type=pa.duration("s"))
+ assert pc.multiply(x, 0.5).equals(half)
+ assert pc.divide(x, 2.0).equals(half)
+ assert pc.multiply(x, 1.5).equals(
+ pa.array([0, 1, 3, 4, 6, 7], type=pa.duration("s")))
Review Comment:
Added Randolf's round trip and `pc.multiply(0.5, x)`, plus a float32 case.
--
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]