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

[Python] read_tensor() fails on non-seekable streams

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.13.0
    • 0.15.0
    • Python
    • pyarrow installed via pip, pyarrow==0.13.0

    Description

      when reading a tensor from from a compressed pyarrow stream, it fails with

      Traceback (most recent call last):
       File "test.py", line 10, in <module>
       tensor = pa.read_tensor(in_stream)
       File "pyarrow/ipc.pxi", line 470, in pyarrow.lib.read_tensor
       File "pyarrow/io.pxi", line 153, in pyarrow.lib.NativeFile.get_random_access_file
       File "pyarrow/io.pxi", line 182, in pyarrow.lib.NativeFile._assert_seekable
      OSError: only valid on seekable files

      example code:

      import pyarrow as pa
      import numpy as np
      
      a = np.random.random(size = (100,110,3) )
      
      out_stream = pa.output_stream('test.pa', compression='gzip', buffer_size=None)
      pa.write_tensor(pa.Tensor.from_numpy(a), out_stream)
      
      in_stream = pa.input_stream('test.pa', compression='gzip', buffer_size=None)
      tensor = pa.read_tensor(in_stream)
      b = pa.Tensor.to_numpy(tensor)

      Attachments

        Issue Links

          Activity

            People

              wesm Wes McKinney
              kkrispin Karsten Krispin
              Votes:
              1 Vote for this issue
              Watchers:
              3 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