You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Wes McKinney <we...@gmail.com> on 2016/06/01 00:44:33 UTC
IO considerations for PyArrow
hi folks,
I wanted to bring up what is likely to become an issue very soon in
the context of our work to provide an Arrow-based Parquet interface
for Python Arrow users.
https://github.com/apache/arrow/pull/83
At the moment, parquet-cpp features an API that enables reading a file
from local disk (using C standard library calls):
https://github.com/apache/parquet-cpp/blob/master/src/parquet/file/reader.h#L111
This is fine for now, however we will quickly need to deal with a few
additional sources of data:
1) File-like Python objects (i.e. an object that has `seek`, `tell`,
and `read` methods)
2) Remote blob stores: HDFS and S3
Implementing #1 at present is a routine exercise in using the Python C
API. #2 is less so -- one of the approaches that has been taken by
others is to create separate Python file-like wrapper classes for
remote storage to make them seem file like. This has multiple
downsides:
- read/seek/tell calls must cross up into the Python interpreter and
back down into the C++ layer
- bytes buffered by read calls get copied into Python bytes objects
(see PyBytes_FromStringAndSize)
Outside of the GIL / concurrency issues, there's efficiency loss that
can be remedied by implementing instead:
- Direct C/C++-level interface (independent of Python interpreter)
with remote blob stores. These can then buffer bytes directly in the
form requested by other C++ consumer libraries (like parquet-cpp)
- Implement a Python file-like interface, so that users can still get
at the bytes in pure Python if they want (for example: some functions,
like pandas.read_csv, primarily deal with file-like things)
This is a clearly superior solution, and has been notably pursued in
recent times by Dato's SFrame library (BSD 3-clause):
https://github.com/dato-code/SFrame/tree/master/oss_src/fileio
The problem, however, is the inevitable scope creep for the PyArrow
Python package. Unlike some other programming languages, Python
programmers face a substantial development complexity burden if they
choose to break libraries containing C extensions into smaller
components, as libraries must define "internal" C APIs for each other
to connect together . Notable example is NumPy
(http://docs.scipy.org/doc/numpy-1.10.1/reference/c-api.html), whose C
API is already being used in PyArrow.
I've been thinking about this problem for several weeks, and my net
recommendation is that we embrace the scope creep in PyArrow (as long
as we try to make optional features, e.g. low-level S3 / libhdfs
integration, "opt-in" versus required for all users). I'd like to hear
from some others, though (e.g. Uwe, Micah, etc.).
thanks,
Wes
Re: IO considerations for PyArrow
Posted by Edmon Begoli <eb...@gmail.com>.
Let me throw a thought - what about looking to support access to different
systems (including Alluxio) through a common POSIX interface such as FUSE?
Will there be a significant performance impact or a loss of control of the
layout?
On Fri, Jun 3, 2016 at 9:26 AM, Uwe Korn <uw...@xhochy.com> wrote:
> Hello,
>
> I would also embrace the scope creep. As we will deal with a lot of data,
> the cross-language I/O impact will significantly matter for performance at
> the end. We definitely have to be careful in making the dependencies
> toggleable in the build system. You should be able to easily get a build
> with all dependencies but also it can very selective on which ones are
> included in a build.
>
> For HDFS and S3 support, I'm not sure if either arrow-cpp, pyarrow or
> parquet-cpp is the right place for their C++ implementation. For arrow-cpp
> it would be the same scope creep as for PyArrow and it could be already
> used by C++ Arrow users but in parquet-cpp these IO classes would also be
> helpful for the non-arrow users. For the moment I would put the C++
> implementations into arrow-cpp, as this keeps the scope creep in Arrow
> itself but already provides value to the C++ users and other languages
> building on that layer.
>
> Cheers,
>
> Uwe
>
>
> On 01.06.16 02:44, Wes McKinney wrote:
>
>> hi folks,
>>
>> I wanted to bring up what is likely to become an issue very soon in
>> the context of our work to provide an Arrow-based Parquet interface
>> for Python Arrow users.
>>
>> https://github.com/apache/arrow/pull/83
>>
>> At the moment, parquet-cpp features an API that enables reading a file
>> from local disk (using C standard library calls):
>>
>>
>> https://github.com/apache/parquet-cpp/blob/master/src/parquet/file/reader.h#L111
>>
>> This is fine for now, however we will quickly need to deal with a few
>> additional sources of data:
>>
>> 1) File-like Python objects (i.e. an object that has `seek`, `tell`,
>> and `read` methods)
>> 2) Remote blob stores: HDFS and S3
>>
>> Implementing #1 at present is a routine exercise in using the Python C
>> API. #2 is less so -- one of the approaches that has been taken by
>> others is to create separate Python file-like wrapper classes for
>> remote storage to make them seem file like. This has multiple
>> downsides:
>>
>> - read/seek/tell calls must cross up into the Python interpreter and
>> back down into the C++ layer
>> - bytes buffered by read calls get copied into Python bytes objects
>> (see PyBytes_FromStringAndSize)
>>
>> Outside of the GIL / concurrency issues, there's efficiency loss that
>> can be remedied by implementing instead:
>>
>> - Direct C/C++-level interface (independent of Python interpreter)
>> with remote blob stores. These can then buffer bytes directly in the
>> form requested by other C++ consumer libraries (like parquet-cpp)
>>
>> - Implement a Python file-like interface, so that users can still get
>> at the bytes in pure Python if they want (for example: some functions,
>> like pandas.read_csv, primarily deal with file-like things)
>>
>> This is a clearly superior solution, and has been notably pursued in
>> recent times by Dato's SFrame library (BSD 3-clause):
>>
>> https://github.com/dato-code/SFrame/tree/master/oss_src/fileio
>>
>> The problem, however, is the inevitable scope creep for the PyArrow
>> Python package. Unlike some other programming languages, Python
>> programmers face a substantial development complexity burden if they
>> choose to break libraries containing C extensions into smaller
>> components, as libraries must define "internal" C APIs for each other
>> to connect together . Notable example is NumPy
>> (http://docs.scipy.org/doc/numpy-1.10.1/reference/c-api.html), whose C
>> API is already being used in PyArrow.
>>
>> I've been thinking about this problem for several weeks, and my net
>> recommendation is that we embrace the scope creep in PyArrow (as long
>> as we try to make optional features, e.g. low-level S3 / libhdfs
>> integration, "opt-in" versus required for all users). I'd like to hear
>> from some others, though (e.g. Uwe, Micah, etc.).
>>
>> thanks,
>> Wes
>>
>
>
Re: IO considerations for PyArrow
Posted by Uwe Korn <uw...@xhochy.com>.
Hello,
I would also embrace the scope creep. As we will deal with a lot of
data, the cross-language I/O impact will significantly matter for
performance at the end. We definitely have to be careful in making the
dependencies toggleable in the build system. You should be able to
easily get a build with all dependencies but also it can very selective
on which ones are included in a build.
For HDFS and S3 support, I'm not sure if either arrow-cpp, pyarrow or
parquet-cpp is the right place for their C++ implementation. For
arrow-cpp it would be the same scope creep as for PyArrow and it could
be already used by C++ Arrow users but in parquet-cpp these IO classes
would also be helpful for the non-arrow users. For the moment I would
put the C++ implementations into arrow-cpp, as this keeps the scope
creep in Arrow itself but already provides value to the C++ users and
other languages building on that layer.
Cheers,
Uwe
On 01.06.16 02:44, Wes McKinney wrote:
> hi folks,
>
> I wanted to bring up what is likely to become an issue very soon in
> the context of our work to provide an Arrow-based Parquet interface
> for Python Arrow users.
>
> https://github.com/apache/arrow/pull/83
>
> At the moment, parquet-cpp features an API that enables reading a file
> from local disk (using C standard library calls):
>
> https://github.com/apache/parquet-cpp/blob/master/src/parquet/file/reader.h#L111
>
> This is fine for now, however we will quickly need to deal with a few
> additional sources of data:
>
> 1) File-like Python objects (i.e. an object that has `seek`, `tell`,
> and `read` methods)
> 2) Remote blob stores: HDFS and S3
>
> Implementing #1 at present is a routine exercise in using the Python C
> API. #2 is less so -- one of the approaches that has been taken by
> others is to create separate Python file-like wrapper classes for
> remote storage to make them seem file like. This has multiple
> downsides:
>
> - read/seek/tell calls must cross up into the Python interpreter and
> back down into the C++ layer
> - bytes buffered by read calls get copied into Python bytes objects
> (see PyBytes_FromStringAndSize)
>
> Outside of the GIL / concurrency issues, there's efficiency loss that
> can be remedied by implementing instead:
>
> - Direct C/C++-level interface (independent of Python interpreter)
> with remote blob stores. These can then buffer bytes directly in the
> form requested by other C++ consumer libraries (like parquet-cpp)
>
> - Implement a Python file-like interface, so that users can still get
> at the bytes in pure Python if they want (for example: some functions,
> like pandas.read_csv, primarily deal with file-like things)
>
> This is a clearly superior solution, and has been notably pursued in
> recent times by Dato's SFrame library (BSD 3-clause):
>
> https://github.com/dato-code/SFrame/tree/master/oss_src/fileio
>
> The problem, however, is the inevitable scope creep for the PyArrow
> Python package. Unlike some other programming languages, Python
> programmers face a substantial development complexity burden if they
> choose to break libraries containing C extensions into smaller
> components, as libraries must define "internal" C APIs for each other
> to connect together . Notable example is NumPy
> (http://docs.scipy.org/doc/numpy-1.10.1/reference/c-api.html), whose C
> API is already being used in PyArrow.
>
> I've been thinking about this problem for several weeks, and my net
> recommendation is that we embrace the scope creep in PyArrow (as long
> as we try to make optional features, e.g. low-level S3 / libhdfs
> integration, "opt-in" versus required for all users). I'd like to hear
> from some others, though (e.g. Uwe, Micah, etc.).
>
> thanks,
> Wes
Re: IO considerations for PyArrow
Posted by Wes McKinney <we...@gmail.com>.
hi Uwe,
Absent an obvious ASF project to move the code to (I'm intrigued by
the idea of an "Apache C++ common" project, much in the way that Boost
became a sprawling library ecosystem of sorts), there may not be a
clear incentive the split the code out if Arrow is the primary
consumer. Particularly since a major goal of Arrow early on is to
facilitate faster IO between systems (even if they don't use the Arrow
data structures as their primary ones).
I'm working on a patch for talking to HDFS (with libhdfs) -- I figure
we'll start there and see how things go.
- Wes
On Fri, Jun 17, 2016 at 7:01 AM, Uwe Korn <uw...@xhochy.com> wrote:
> Hello Wes,
>
> the concept sounds sensible and really useful.
>
> Probably the implementation will reside in the beginning fully inside of
> Arrow but do you plan to split it up into a separate package later on?
>
> Cheers
> Uwe
>
Re: IO considerations for PyArrow
Posted by Uwe Korn <uw...@xhochy.com>.
Hello Wes,
the concept sounds sensible and really useful.
Probably the implementation will reside in the beginning fully inside of
Arrow but do you plan to split it up into a separate package later on?
Cheers
Uwe
On 16.06.16 03:35, Wes McKinney wrote:
> Hi folks,
>
> I put some more thought into the "IO problem" as it relates Arrow in
> C++ (and transitively, Python) and wrote a short Google document with
> my thoughts on it:
>
> https://docs.google.com/document/d/16y-eyIgSVL8m5Q7Mmh-jIDRwlh-r0bYatYuDl4sbMIk/edit#
>
> Feedback greatly appreciated! This will be on my critical path in the
> near future, so I would like to know if I'm approaching the problem
> right, and we are in alignment (then can break things down into a
> bunch of JIRAs).
>
> (I can also post this doc directly to the mailing list, I thought the
> initial discussion would be simpler in a GDoc)
>
> Thank you
> Wes
>
> On Wed, Jun 8, 2016 at 4:11 PM, Wes McKinney <we...@gmail.com> wrote:
>> On Fri, Jun 3, 2016 at 10:16 AM, Micah Kornfield <em...@gmail.com> wrote:
>>> Hi Wes,
>>>
>>> At what level do you imagine, the "opt-in" happening. Right now it
>>> seems like it would be fairly straightforward at build time. However,
>>> when we start packaging pyarrow for distribution how do you imagine it
>>> will work? (If [1] already answers this, please let me know, I've been
>>> meaning to take a look at it).
>>>
>> Where packaging and distribution is concerned, it'd be easiest to
>> provide non-picky users with a kitchen sink build, but otherwise
>> developers could create precisely the build they want with CMake
>> flags, I guess. If certain libraries aren't found then we wouldn't
>> fail the build by default, for example.
>>
>>> I need to grok the python code base a little bit more to understand
>>> the implications of the scope creep and the pain around taking a more
>>> fine-grained component approach. But in general my experience has
>>> been that packaging things together while maintaining clear internal
>>> code boundaries for later separation is a good pragmatic approach.
>>>
>> I'd propose creating an `arrow_io` leaf shared library where we can
>> create a small IO subsystem for reuse amongst different data
>> connectors. We can leave things fairly coarse grained for the time
>> being and break things up later if it becomes onerous for other Arrow
>> developer-users.
>>
>>> As a side note, hopefully, we'll be able to re-use some existing
>>> projects to do the heavy lifting for blob store integration. SFrame
>>> is one option [2] and [3] might be worth investigating as well (both
>>> appear to be Apache 2.0 licensed).
>> While requiring Java + $HADOOP_HOME for HDFS connectivity (wrapper
>> around libhdfs) doesn't excite me that much, the prospect of bugs (or
>> secure cluster issues) creeping up from a 3rd-party HDFS client
>> without the ability to escalate problems to the Apache Hadoop team
>> worries me even more. There is a new official C++ HDFS client in the
>> works after the libhdfs3 patch was not accepted
>> (https://issues.apache.org/jira/browse/HDFS-8707), so this may be
>> worth pursuing once it matures.
>>
>> Thoughts on this welcome.
>>
>> - Wes
>>
>>> Thanks,
>>> -Micah
>>>
>>> [1] https://github.com/apache/arrow/pull/79/files
>>> [2] https://github.com/apache/incubator-hawq/tree/master/depends/libhdfs3
>>> [3] https://github.com/aws/aws-sdk-cpp
>>>
>>>
Re: IO considerations for PyArrow
Posted by pino patera <pi...@gmail.com>.
Looks a good idea.In order to take advantage of async IO, it'd be nice
having a concept of chunking for large objects and "pipelining" in the
sense of starting the serialization/deserelezation while reading/writing
the chunks. In some application, it can be very useful when dealing with
large objects for instance with timeseries it'd be possible starting a
partial computation on the first semantically complete chunk, while chunks
are retievied by IO subsystem.
--Pino
On Thu, Jun 16, 2016 at 3:36 AM Wes McKinney <we...@gmail.com> wrote:
> Hi folks,
>
> I put some more thought into the "IO problem" as it relates Arrow in
> C++ (and transitively, Python) and wrote a short Google document with
> my thoughts on it:
>
>
> https://docs.google.com/document/d/16y-eyIgSVL8m5Q7Mmh-jIDRwlh-r0bYatYuDl4sbMIk/edit#
>
> Feedback greatly appreciated! This will be on my critical path in the
> near future, so I would like to know if I'm approaching the problem
> right, and we are in alignment (then can break things down into a
> bunch of JIRAs).
>
> (I can also post this doc directly to the mailing list, I thought the
> initial discussion would be simpler in a GDoc)
>
> Thank you
> Wes
>
> On Wed, Jun 8, 2016 at 4:11 PM, Wes McKinney <we...@gmail.com> wrote:
> > On Fri, Jun 3, 2016 at 10:16 AM, Micah Kornfield <em...@gmail.com>
> wrote:
> >> Hi Wes,
> >>
> >> At what level do you imagine, the "opt-in" happening. Right now it
> >> seems like it would be fairly straightforward at build time. However,
> >> when we start packaging pyarrow for distribution how do you imagine it
> >> will work? (If [1] already answers this, please let me know, I've been
> >> meaning to take a look at it).
> >>
> >
> > Where packaging and distribution is concerned, it'd be easiest to
> > provide non-picky users with a kitchen sink build, but otherwise
> > developers could create precisely the build they want with CMake
> > flags, I guess. If certain libraries aren't found then we wouldn't
> > fail the build by default, for example.
> >
> >> I need to grok the python code base a little bit more to understand
> >> the implications of the scope creep and the pain around taking a more
> >> fine-grained component approach. But in general my experience has
> >> been that packaging things together while maintaining clear internal
> >> code boundaries for later separation is a good pragmatic approach.
> >>
> >
> > I'd propose creating an `arrow_io` leaf shared library where we can
> > create a small IO subsystem for reuse amongst different data
> > connectors. We can leave things fairly coarse grained for the time
> > being and break things up later if it becomes onerous for other Arrow
> > developer-users.
> >
> >> As a side note, hopefully, we'll be able to re-use some existing
> >> projects to do the heavy lifting for blob store integration. SFrame
> >> is one option [2] and [3] might be worth investigating as well (both
> >> appear to be Apache 2.0 licensed).
> >
> > While requiring Java + $HADOOP_HOME for HDFS connectivity (wrapper
> > around libhdfs) doesn't excite me that much, the prospect of bugs (or
> > secure cluster issues) creeping up from a 3rd-party HDFS client
> > without the ability to escalate problems to the Apache Hadoop team
> > worries me even more. There is a new official C++ HDFS client in the
> > works after the libhdfs3 patch was not accepted
> > (https://issues.apache.org/jira/browse/HDFS-8707), so this may be
> > worth pursuing once it matures.
> >
> > Thoughts on this welcome.
> >
> > - Wes
> >
> >>
> >> Thanks,
> >> -Micah
> >>
> >> [1] https://github.com/apache/arrow/pull/79/files
> >> [2]
> https://github.com/apache/incubator-hawq/tree/master/depends/libhdfs3
> >> [3] https://github.com/aws/aws-sdk-cpp
> >>
> >>
>
Re: IO considerations for PyArrow
Posted by Wes McKinney <we...@gmail.com>.
Hi folks,
I put some more thought into the "IO problem" as it relates Arrow in
C++ (and transitively, Python) and wrote a short Google document with
my thoughts on it:
https://docs.google.com/document/d/16y-eyIgSVL8m5Q7Mmh-jIDRwlh-r0bYatYuDl4sbMIk/edit#
Feedback greatly appreciated! This will be on my critical path in the
near future, so I would like to know if I'm approaching the problem
right, and we are in alignment (then can break things down into a
bunch of JIRAs).
(I can also post this doc directly to the mailing list, I thought the
initial discussion would be simpler in a GDoc)
Thank you
Wes
On Wed, Jun 8, 2016 at 4:11 PM, Wes McKinney <we...@gmail.com> wrote:
> On Fri, Jun 3, 2016 at 10:16 AM, Micah Kornfield <em...@gmail.com> wrote:
>> Hi Wes,
>>
>> At what level do you imagine, the "opt-in" happening. Right now it
>> seems like it would be fairly straightforward at build time. However,
>> when we start packaging pyarrow for distribution how do you imagine it
>> will work? (If [1] already answers this, please let me know, I've been
>> meaning to take a look at it).
>>
>
> Where packaging and distribution is concerned, it'd be easiest to
> provide non-picky users with a kitchen sink build, but otherwise
> developers could create precisely the build they want with CMake
> flags, I guess. If certain libraries aren't found then we wouldn't
> fail the build by default, for example.
>
>> I need to grok the python code base a little bit more to understand
>> the implications of the scope creep and the pain around taking a more
>> fine-grained component approach. But in general my experience has
>> been that packaging things together while maintaining clear internal
>> code boundaries for later separation is a good pragmatic approach.
>>
>
> I'd propose creating an `arrow_io` leaf shared library where we can
> create a small IO subsystem for reuse amongst different data
> connectors. We can leave things fairly coarse grained for the time
> being and break things up later if it becomes onerous for other Arrow
> developer-users.
>
>> As a side note, hopefully, we'll be able to re-use some existing
>> projects to do the heavy lifting for blob store integration. SFrame
>> is one option [2] and [3] might be worth investigating as well (both
>> appear to be Apache 2.0 licensed).
>
> While requiring Java + $HADOOP_HOME for HDFS connectivity (wrapper
> around libhdfs) doesn't excite me that much, the prospect of bugs (or
> secure cluster issues) creeping up from a 3rd-party HDFS client
> without the ability to escalate problems to the Apache Hadoop team
> worries me even more. There is a new official C++ HDFS client in the
> works after the libhdfs3 patch was not accepted
> (https://issues.apache.org/jira/browse/HDFS-8707), so this may be
> worth pursuing once it matures.
>
> Thoughts on this welcome.
>
> - Wes
>
>>
>> Thanks,
>> -Micah
>>
>> [1] https://github.com/apache/arrow/pull/79/files
>> [2] https://github.com/apache/incubator-hawq/tree/master/depends/libhdfs3
>> [3] https://github.com/aws/aws-sdk-cpp
>>
>>
Re: IO considerations for PyArrow
Posted by Wes McKinney <we...@gmail.com>.
On Fri, Jun 3, 2016 at 10:16 AM, Micah Kornfield <em...@gmail.com> wrote:
> Hi Wes,
>
> At what level do you imagine, the "opt-in" happening. Right now it
> seems like it would be fairly straightforward at build time. However,
> when we start packaging pyarrow for distribution how do you imagine it
> will work? (If [1] already answers this, please let me know, I've been
> meaning to take a look at it).
>
Where packaging and distribution is concerned, it'd be easiest to
provide non-picky users with a kitchen sink build, but otherwise
developers could create precisely the build they want with CMake
flags, I guess. If certain libraries aren't found then we wouldn't
fail the build by default, for example.
> I need to grok the python code base a little bit more to understand
> the implications of the scope creep and the pain around taking a more
> fine-grained component approach. But in general my experience has
> been that packaging things together while maintaining clear internal
> code boundaries for later separation is a good pragmatic approach.
>
I'd propose creating an `arrow_io` leaf shared library where we can
create a small IO subsystem for reuse amongst different data
connectors. We can leave things fairly coarse grained for the time
being and break things up later if it becomes onerous for other Arrow
developer-users.
> As a side note, hopefully, we'll be able to re-use some existing
> projects to do the heavy lifting for blob store integration. SFrame
> is one option [2] and [3] might be worth investigating as well (both
> appear to be Apache 2.0 licensed).
While requiring Java + $HADOOP_HOME for HDFS connectivity (wrapper
around libhdfs) doesn't excite me that much, the prospect of bugs (or
secure cluster issues) creeping up from a 3rd-party HDFS client
without the ability to escalate problems to the Apache Hadoop team
worries me even more. There is a new official C++ HDFS client in the
works after the libhdfs3 patch was not accepted
(https://issues.apache.org/jira/browse/HDFS-8707), so this may be
worth pursuing once it matures.
Thoughts on this welcome.
- Wes
>
> Thanks,
> -Micah
>
> [1] https://github.com/apache/arrow/pull/79/files
> [2] https://github.com/apache/incubator-hawq/tree/master/depends/libhdfs3
> [3] https://github.com/aws/aws-sdk-cpp
>
>
Re: IO considerations for PyArrow
Posted by Micah Kornfield <em...@gmail.com>.
Hi Wes,
At what level do you imagine, the "opt-in" happening. Right now it
seems like it would be fairly straightforward at build time. However,
when we start packaging pyarrow for distribution how do you imagine it
will work? (If [1] already answers this, please let me know, I've been
meaning to take a look at it).
I need to grok the python code base a little bit more to understand
the implications of the scope creep and the pain around taking a more
fine-grained component approach. But in general my experience has
been that packaging things together while maintaining clear internal
code boundaries for later separation is a good pragmatic approach.
As a side note, hopefully, we'll be able to re-use some existing
projects to do the heavy lifting for blob store integration. SFrame
is one option [2] and [3] might be worth investigating as well (both
appear to be Apache 2.0 licensed).
Thanks,
-Micah
[1] https://github.com/apache/arrow/pull/79/files
[2] https://github.com/apache/incubator-hawq/tree/master/depends/libhdfs3
[3] https://github.com/aws/aws-sdk-cpp
On Tue, May 31, 2016 at 5:44 PM, Wes McKinney <we...@gmail.com> wrote:
> hi folks,
>
> I wanted to bring up what is likely to become an issue very soon in
> the context of our work to provide an Arrow-based Parquet interface
> for Python Arrow users.
>
> https://github.com/apache/arrow/pull/83
>
> At the moment, parquet-cpp features an API that enables reading a file
> from local disk (using C standard library calls):
>
> https://github.com/apache/parquet-cpp/blob/master/src/parquet/file/reader.h#L111
>
> This is fine for now, however we will quickly need to deal with a few
> additional sources of data:
>
> 1) File-like Python objects (i.e. an object that has `seek`, `tell`,
> and `read` methods)
> 2) Remote blob stores: HDFS and S3
>
> Implementing #1 at present is a routine exercise in using the Python C
> API. #2 is less so -- one of the approaches that has been taken by
> others is to create separate Python file-like wrapper classes for
> remote storage to make them seem file like. This has multiple
> downsides:
>
> - read/seek/tell calls must cross up into the Python interpreter and
> back down into the C++ layer
> - bytes buffered by read calls get copied into Python bytes objects
> (see PyBytes_FromStringAndSize)
>
> Outside of the GIL / concurrency issues, there's efficiency loss that
> can be remedied by implementing instead:
>
> - Direct C/C++-level interface (independent of Python interpreter)
> with remote blob stores. These can then buffer bytes directly in the
> form requested by other C++ consumer libraries (like parquet-cpp)
>
> - Implement a Python file-like interface, so that users can still get
> at the bytes in pure Python if they want (for example: some functions,
> like pandas.read_csv, primarily deal with file-like things)
>
> This is a clearly superior solution, and has been notably pursued in
> recent times by Dato's SFrame library (BSD 3-clause):
>
> https://github.com/dato-code/SFrame/tree/master/oss_src/fileio
>
> The problem, however, is the inevitable scope creep for the PyArrow
> Python package. Unlike some other programming languages, Python
> programmers face a substantial development complexity burden if they
> choose to break libraries containing C extensions into smaller
> components, as libraries must define "internal" C APIs for each other
> to connect together . Notable example is NumPy
> (http://docs.scipy.org/doc/numpy-1.10.1/reference/c-api.html), whose C
> API is already being used in PyArrow.
>
> I've been thinking about this problem for several weeks, and my net
> recommendation is that we embrace the scope creep in PyArrow (as long
> as we try to make optional features, e.g. low-level S3 / libhdfs
> integration, "opt-in" versus required for all users). I'd like to hear
> from some others, though (e.g. Uwe, Micah, etc.).
>
> thanks,
> Wes