u3Izx9ql7vW4 opened a new issue, #43929:
URL: https://github.com/apache/arrow/issues/43929

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Hello,
   
   I'm trying to save a table to a memory mapped file, but I'm getting an error:
   
   ```bash
       writer.write_table(table, max_chunksize=1000)
     File "pyarrow/ipc.pxi", line 529, in 
pyarrow.lib._CRecordBatchWriter.write_table
     File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
   OSError: Write out of bounds (offset = 13784, size = 1496) in file of size 
14638
   ```
   
   Below is the code that generated the error. Note that there are 
significantly fewer than 1000 records being saved. 
   
   ```python
   def save_data():
       size = table.get_total_buffer_size()
   
       file_path = os.path.join(prefix_stream, sink)
   
       pa.create_memory_map(file_path, size)
   
       with pa.memory_map(file_path, 'wb') as sink:
           with pa.ipc.new_file(sink, table.schema) as writer:
               writer.write_table(table, max_chunksize=1000)
   ```
   I tried `write_batch`, and get the same error. 
   
   I also tried `sink.seek(0)`, and get
   ```
   OSError: only valid on readable files
   ```
   
   Does anyone know what's causing the 13kb offset? 
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to