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 2020/06/04 19:15:00 UTC

[GitHub] [arrow] jorisvandenbossche commented on pull request #7349: ARROW-8766: [Python] Allow implementing filesystems in Python

jorisvandenbossche commented on pull request #7349:
URL: https://github.com/apache/arrow/pull/7349#issuecomment-639062788


   A first test case is working, using fsspec's in-memory filesystem:
   
   ```
   In [1]: import pyarrow.parquet as pq
      ...: import pyarrow.dataset as ds
      ...:
      ...: from pyarrow.fs import PyFileSystem
      ...: from pyarrow.tests.test_fs import FSSpecHandler
   
   In [2]: import fsspec
   
   In [3]: memfs = fsspec.filesystem("memory")
   
   In [4]: table = pa.table({'a': [1, 2, 3]})
   
   In [5]: with memfs.open("test", "wb") as f:
      ...:     pq.write_table(table, f)
      ...:
   
   In [6]: dataset = ds.dataset("test", filesystem=PyFileSystem(FSSpecHandler(memfs)))
   
   In [7]: dataset.to_table(filter=ds.field('a') > 1).to_pandas()
   Out[7]:
      a
   0  2
   1  3
   ```
   
   I only have a bit trouble finding a robust way to get a file handle for an open file from the fsspec filesystem, but so that is not related to this PR ;) For the rest it was quite easy to get this working!


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