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/01/12 07:03:18 UTC

[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #11882: ARROW-9843: [C++] Implement Between ternary kernel

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



##########
File path: python/pyarrow/tests/test_compute.py
##########
@@ -1262,6 +1263,300 @@ def test_filter_null_type():
     assert len(table.filter(mask).column(0)) == 5
 
 
+@pytest.mark.parametrize("ty", ["inclusive"])
+def test_between_array_array_array(ty):
+    BetweenOptions = partial(pc.BetweenOptions)
+
+    val = pa.array([1, 1, 4, 3, 2, 6])
+    arr1 = pa.array([1, 1, 3, 4, None, 5])
+    arr2 = pa.array([1, 2, 4, None, 4, 7])
+
+    inclusive_and_expected = {
+        "both": [True, True, True, None, None, True],
+        "left": [False, True, False, None, None, True],
+        "right": [False, False, True, None, None, True],
+        "neither": [False, False, False, None, None, True],
+    }
+
+    for inclusive, expected in inclusive_and_expected.items():
+        options = BetweenOptions(inclusive=inclusive)
+        result = pc.between(val, arr1, arr2, options=options)
+        np.testing.assert_array_equal(result, pa.array(expected))

Review comment:
       ```suggestion
           assert result.equals(pa.array(expected))
   ```
   
   Since you are comparing pyarrow arrays, this is better than coercing to numpy arrays with np.testing
   
   Same for the occurrences below




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