[
https://issues.apache.org/jira/browse/ARROW-2150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16392984#comment-16392984
]
ASF GitHub Bot commented on ARROW-2150:
---------------------------------------
wesm closed pull request #1729: ARROW-2150: [Python] Raise NotImplementedError
when comparing with pyarrow.Array for now
URL: https://github.com/apache/arrow/pull/1729
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi
index e785c0ec5..f05806cfa 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 f034d78b3..4c14c1c61 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)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [Python] array equality defaults to identity
> --------------------------------------------
>
> Key: ARROW-2150
> URL: https://issues.apache.org/jira/browse/ARROW-2150
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 0.8.0
> Reporter: Antoine Pitrou
> Assignee: Wes McKinney
> Priority: Minor
> Labels: pull-request-available
> Fix For: 0.9.0
>
>
> I'm not sure this is deliberate, but it doesn't look very desirable to me:
> {code}
> >>> pa.array([1,2,3], type=pa.int32()) == pa.array([1,2,3], type=pa.int32())
> False
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)