fsspec / fsspec/filesystem_spec

read an HDFS file by line failed when the open_mode is "rb"

Open
#810 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

Hi there,

I found some problems when I read an HDFS file by line when the open_mode is "rb". It works fine when the open_mode is "r" or the file is located locally.

some snippets:


import fsspec

hdfs_file_path = "hdfs://xxxxxx"
with fsspec.open(hdfs_file_path, "rb") as f:
    # raise UnspportedOperation
    f.readline()

Error logs:

/opt/conda/lib/python3.7/site-packages/pyarrow/io.pxi in pyarrow.lib.NativeFile.readline()

UnsupportedOperation:

Envs:

System: Ubuntu 18.04
fsspec: 2021.10.1
pyarrow: 6.0.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the HDFS example through fsspec.open with open_mode "rb", then trace the HDFS-backed file object to the pyarrow NativeFile.readline() call shown in the error. Compare this behavior with local files and mode "r"; done means line reads work for binary HDFS handles without raising UnsupportedOperation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.