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

[Python] Misleading error message when calling pyarrow.read_record_batch on a complete IPC stream

    XMLWordPrintableJSON

Details

    Description

      >>> batch = pa.RecordBatch.from_arrays([pa.array([b"foo"], type=pa.utf8())], names=['strs'])                                                                   
      >>> stream = pa.BufferOutputStream()
      >>> writer = pa.RecordBatchStreamWriter(stream, batch.schema)
      >>> writer.write_batch(batch)                                                                                                                                  
      >>> writer.close()                                                                                                                                             
      >>> buf = stream.getvalue()                                                                                                                                    
      >>> pa.read_record_batch(buf, batch.schema)                                                                                                                    
      Traceback (most recent call last):
        File "<ipython-input-31-4f168f453f3a>", line 1, in <module>
          pa.read_record_batch(buf, batch.schema)
        File "pyarrow/ipc.pxi", line 583, in pyarrow.lib.read_record_batch
          check_status(ReadRecordBatch(deref(message.message.get()),
        File "pyarrow/error.pxi", line 87, in pyarrow.lib.check_status
          raise ArrowIOError(message)
      ArrowIOError: Expected IPC message of type schema got record batch
      
      

      Attachments

        Issue Links

          Activity

            People

              wesm Wes McKinney
              apitrou Antoine Pitrou
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h