Commits

Wes McKinney authored c7e6a071630
ARROW-302: [C++/Python] Implement C++ IO interfaces for interacting with Python file and bytes objects This will enable code (such as arrow IPC or Parquet) that only knows about Arrow's IO subsystem to interact with Python objects in various ways. In other words, when we have in C++: ``` std::shared_ptr<io::ReadableFileInterface> handle = ...; handle->Read(nbytes, &out); ``` then the C++ file handle could be invoking the `read` method of a Python object. Same goes for `arrow::io::OutputStream` and `write` methods. There's data copying in some places overhead because of the rigid memory ownership semantics of the `PyBytes` type, but this can't be avoided here. Another nice thing is that if we have some data in a Python bytes object that we want to expose to some other C++ component, we can wrap it in the `PyBytesReader` which provides zero-copy read access to the underlying data. Author: Wes McKinney <wes.mckinney@twosigma.com> Closes #152 from wesm/ARROW-302 and squashes the following commits: 2de9f97 [Wes McKinney] Fix compiler warning / bug from OS X 316b845 [Wes McKinney] Code review comments e791893 [Wes McKinney] Python 2.7 fix 0fc4cf1 [Wes McKinney] cpplint e9b8c60 [Wes McKinney] Test the size() method and fix bug with missing whence 6481e91 [Wes McKinney] Add a zero-copy reader for PyBytes 7e357eb [Wes McKinney] Get basic Python file read/write working d470133 [Wes McKinney] Share default implementations of ReadAt, add Buffer-based Read API 737a8db [Wes McKinney] Refactoring, more code sharing with native file interfaces 8be433f [Wes McKinney] Draft PyReadableFile implementation, not yet tested 20a3f28 [Wes McKinney] Draft API for Arrow IO wrappers for Python files