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

[Python] Always raise ArrowTypeError instead of TypeError inside pyarrow.array

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 0.15.1, 0.16.0
    • None
    • Python
    • None

    Description

      The following data structure passed to `pa.array` raises a generic `TypeError`:

      import pyarrow as pa
      pa.array([{'TestKey': [123456, 'foo']}])
      
      Traceback (most recent call last):
       File "pyarrow_list_test.py", line 30, in <module>
       pa_array = pa.array([\{'TestKey': [123456, 'foo']}])
       File "pyarrow/array.pxi", line 269, in pyarrow.lib.array
       File "pyarrow/array.pxi", line 38, in pyarrow.lib._sequence_to_array
      TypeError: an integer is required (got type str)
      

      I understand there may be a way to overcome this by setting the `type` value as an argument to `pa.array`, but the use case here is storing results of a SQL query where the structure/type of the column is unknown.

      If Arrow is ultimately unable to handle this data structure without a predefined `type` passed to `pa.array`, can the exception at least us the PyArrow namespace (e.g. `pa.lib.ArrowTypeError` or `pa.lib.ArrowNotImplementedError).

      Any other workaround suggestions welcome.

      Attachments

        Activity

          People

            Unassigned Unassigned
            robdiciuccio Rob DiCiuccio
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: