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 2021/05/03 14:12:35 UTC

[GitHub] [arrow] amol- commented on a change in pull request #10199: ARROW-12431: [C++] Mask is inverted when creating FixedSizeBinaryArray

amol- commented on a change in pull request #10199:
URL: https://github.com/apache/arrow/pull/10199#discussion_r625114336



##########
File path: python/pyarrow/tests/test_array.py
##########
@@ -2666,6 +2666,31 @@ def test_array_masked():
     assert arr.type == pa.int64()
 
 
+def test_binary_array_masked():
+    # ARROW-12431
+    masked_basic = pa.array([b'\x05'], type=pa.binary(1),
+                            mask=np.array([False]))
+    assert [b'\x05'] == masked_basic.to_pylist()
+
+    # Fixed Length Binary
+    masked = pa.array(np.array([b'\x05']), type=pa.binary(1),
+                      mask=np.array([False]))
+    assert [b'\x05'] == masked.to_pylist()
+
+    masked_nulls = pa.array(np.array([b'\x05']), type=pa.binary(1),
+                            mask=np.array([True]))
+    assert [None] == masked_nulls.to_pylist()
+
+    # Variable Length Binary
+    masked = pa.array(np.array([b'\x05']), type=pa.binary(-1),

Review comment:
       I thought that it was better to make it explicit that we were testing against a variable length binary, but given that ``-1``  is the default anyway I guess it doesn't make much difference.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org