AlenkaF commented on code in PR #55811:
URL: https://github.com/apache/arrow/pull/55811#discussion_r4769561973


##########
python/pyarrow/tests/test_compute.py:
##########
@@ -4631,3 +4631,32 @@ def test_winsorize():
     result = pc.winsorize(
         arr, options=pc.WinsorizeOptions(lower_limit=0.1, upper_limit=0.8))
     assert result.to_pylist() == [8, 4, 8, 8, 5, 3, 7, 2, 2, 6]
+
+
+def test_interval_between():
+    arr1 = pa.array(
+        [datetime.datetime(2020, 1, 1), None, datetime.datetime(1900, 12, 13)],
+        type=pa.timestamp('s')
+    )
+    arr2 = pa.array(
+        [datetime.datetime(2020, 5, 5), datetime.datetime(2020, 10, 1),
+         datetime.datetime(2020, 1, 1)],
+        type=pa.timestamp('s')
+    )
+    result = pc.month_day_nano_interval_between(arr1, arr2)
+    assert isinstance(result, pa.MonthDayNanoIntervalArray)
+    assert isinstance(result[0], pa.MonthDayNanoIntervalScalar)
+
+    result = pc.month_interval_between(arr1, arr2)
+    assert isinstance(result, pa.MonthIntervalArray)
+    assert isinstance(result[0], pa.MonthIntervalScalar)
+    assert str(result[0]) == "4M"
+    assert result.to_pylist() == [pa.Month([4]), None, pa.Month([1429])]
+
+    result = pc.day_time_interval_between(arr1, arr2)
+    assert isinstance(result, pa.DayTimeIntervalArray)
+    assert isinstance(result[0], pa.DayTimeIntervalScalar)
+    assert str(result[0]) == "125d0ms"
+    assert result.to_pylist() == [pa.DayTime([125, 0]),
+                                  None,
+                                  pa.DayTime([43483, 0])]

Review Comment:
   a563c90fd1853c6c2154ee9e433d9c101f2c005d



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