Skip to content
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

find doesn't accept maxdepth parameter #435

Open
justinvyu opened this issue Oct 26, 2023 · 1 comment
Open

find doesn't accept maxdepth parameter #435

justinvyu opened this issue Oct 26, 2023 · 1 comment

Comments

@justinvyu
Copy link

The fsspec find interface accepts maxdepth, but the adlfs implementation doesn't actually use this parameter -- so it always recursively lists all files in the directory.

See here:

def find(self, path, withdirs=False, prefix="", **kwargs):

pyarrow's wrapper of fsspec filesystems uses fs.find to perform a list operation at a directory. This makes use of the maxdepth parameter when the user specifies recursive=False in pyarrow.

fs = pyarrow.fs.PyFileSystem(pyarrow.fs.FSSpecHandler(fsspec_fs))
file_infos = fs.get_file_info(
    pyarrow.fs.FileSelector("path", recursive=False)
)
# All files under path will be recursively listed, rather than just the top level.

Easy fix is to just take the gcsfs implementation:

https://github.com/fsspec/gcsfs/blob/ad684a5b3f25d46eeb5c3aebdbe647056a5e312b/gcsfs/core.py#L1441-L1444

@fardinabbasi
Copy link

fardinabbasi commented Oct 27, 2023

The fsspec find interface accepts maxdepth, but the adlfs implementation doesn't actually use this parameter -- so it always recursively lists all files in the directory.

Same issue!

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

No branches or pull requests

2 participants