Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-2423

[Python] PyArrow datatypes raise ValueError on equality checks against non-PyArrow objects

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 0.10.0
    • Component/s: Python
    • Environment:
      Mac OS High Sierra
      PyArrow 0.9.0 (py36_1)
      Python 3.6.3

      Description

      Checking a PyArrow datatype object for equality with non-PyArrow datatypes causes a `ValueError` to be raised, rather than either returning a True/False value, or returning NotImplemented if the comparison isn't implemented.

      E.g. attempting to call:

      import pyarrow
      pyarrow.int32() == 'foo'
      

      results in:

      Traceback (most recent call last):
        File "types.pxi", line 1221, in pyarrow.lib.type_for_alias
      KeyError: 'foo'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "t.py", line 2, in <module>
          pyarrow.int32() == 'foo'
        File "types.pxi", line 90, in pyarrow.lib.DataType.__richcmp__
        File "types.pxi", line 113, in pyarrow.lib.DataType.equals
        File "types.pxi", line 1223, in pyarrow.lib.type_for_alias
      ValueError: No type alias for foo
      

      The expected outcome for the above would be for the comparison to return `False`, as that's the general behaviour for comparisons between objects of different types (e.g. `1 == 'foo'` or `object() == 12.4` both return `False`).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kszucs Krisztian Szucs
                Reporter:
                suicas Dave Challis
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: