Skip to content

[add] seekable for ArrowFile #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 13, 2023

Conversation

nyamashi
Copy link
Contributor

Fix #1153

ref:
https://arrow.apache.org/docs/python/generated/pyarrow.fs.HadoopFileSystem.html#pyarrow.fs.HadoopFileSystem

  • open_*_streams and open_input_file of pyarrow.fs.HadoopFileSystem return pyarrow.NativeFile.
  • pyarrow.NativeFile supports seekable.

@martindurant
Copy link
Member

Can we perhaps add a test in test_arrow.py which checks seekable works?

@nyamashi
Copy link
Contributor Author

Got it! I'll try to add a test in test_arrow.py.

@nyamashi
Copy link
Contributor Author

nyamashi commented Jan 13, 2023

I'd added a test case but I couldn't checked via pytest fsspec. 🤔
However the following code looks working on my local environment.

def test_seekable(fs, hdfs_path):
    for seekable in [True, False]:                                                                                                                                                   
        with fs.open(hdfs_path, "rb", seekable=seekable) as file:                                                                                                        
            assert file.seekable() == seekable 
my_hdfs_url = 'hdfs://foo/bar/'
fs, my_hdfs_path = fsspec.core.url_to_fs(my_hdfs_url)
test_seekable(fs, my_hdfs_path + "/baz")

Could you run the test code on your environment? 🙇

@martindurant
Copy link
Member

Thanks!

@f4hy
Copy link

f4hy commented Feb 24, 2023

This looks like it makes it possible to fix pandas-dev/pandas#50639 but it is unclear how pandas could pass the seekable option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArrowFile: seekable() method
3 participants