This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 23d08b7  ARROW-2150: [Python] Raise NotImplementedError when comparing 
with pyarrow.Array for now
23d08b7 is described below

commit 23d08b7e68190159caac719d35e0e7578fdef36c
Author: Wes McKinney <[email protected]>
AuthorDate: Fri Mar 9 10:17:31 2018 -0500

    ARROW-2150: [Python] Raise NotImplementedError when comparing with 
pyarrow.Array for now
    
    Author: Wes McKinney <[email protected]>
    
    Closes #1729 from wesm/ARROW-2150 and squashes the following commits:
    
    f0ddcf5e <Wes McKinney> Raise NotImplementedError when comparing with 
pyarrow.Array for now
---
 python/pyarrow/array.pxi           |  4 ++++
 python/pyarrow/tests/test_array.py | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi
index e785c0e..f05806c 100644
--- a/python/pyarrow/array.pxi
+++ b/python/pyarrow/array.pxi
@@ -267,6 +267,10 @@ cdef class Array:
         self.ap = sp_array.get()
         self.type = pyarrow_wrap_data_type(self.sp_array.get().type())
 
+    def __richcmp__(Array self, object other, int op):
+        raise NotImplementedError('Comparisons with pyarrow.Array are not '
+                                  'implemented')
+
     def _debug_print(self):
         with nogil:
             check_status(DebugPrint(deref(self.ap), 0))
diff --git a/python/pyarrow/tests/test_array.py 
b/python/pyarrow/tests/test_array.py
index f034d78..4c14c1c 100644
--- a/python/pyarrow/tests/test_array.py
+++ b/python/pyarrow/tests/test_array.py
@@ -158,6 +158,16 @@ def test_array_ref_to_ndarray_base():
     assert sys.getrefcount(arr) == (refcount + 1)
 
 
+def test_array_eq_raises():
+    # ARROW-2150: we are raising when comparing arrays until we define the
+    # behavior to either be elementwise comparisons or data equality
+    arr1 = pa.array([1, 2, 3], type=pa.int32())
+    arr2 = pa.array([1, 2, 3], type=pa.int32())
+
+    with pytest.raises(NotImplementedError):
+        arr1 == arr2
+
+
 def test_dictionary_from_numpy():
     indices = np.repeat([0, 1, 2], 2)
     dictionary = np.array(['foo', 'bar', 'baz'], dtype=object)

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to