You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/01 14:37:59 UTC

[GitHub] [arrow] lidavidm commented on a change in pull request #10427: ARROW-12881: [Python] Pyarrow IPC guide is missing sink.close()

lidavidm commented on a change in pull request #10427:
URL: https://github.com/apache/arrow/pull/10427#discussion_r643164275



##########
File path: docs/source/python/ipc.rst
##########
@@ -105,6 +105,11 @@ An important point is that if the input source supports zero-copy reads
 (e.g. like a memory map, or ``pyarrow.BufferReader``), then the returned
 batches are also zero-copy and do not allocate any new memory on read.
 
+All stream objects have a ``close`` method. In the above example 
+:func:`~pyarrow.BufferOutputStream.getvalue` both closes and returns the buffer.
+If the return object is not needed, call the relevent ``close`` method
+after you are finished using the object to avoid data corruption issues.

Review comment:
       This is a little specific to BufferOutputStream (which is used for convenience in this example). I think the relevant point is that closing the writer does not close the stream, so you must close the stream/file yourself to ensure all data is persisted. (And maybe note that in this example, we don't do that as `getvalue` implicitly closes the stream.)




-- 
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.

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