fsspec / fsspec/filesystem_spec

`FTPFileSystem` incompatibility with `pandas`/`pyarrow`

Open
#705 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

I've run across an issue, and to be honest I'm not quite sure which library it belongs in.

It starts with the line

df.to_parquet(
    path=path,
    partition_cols=partition_cols,
    storage_options=fs.storage_options
)

which takes me through the pandas library until reaching this function in pyarrow

https://github.com/apache/arrow/blob/e2238582e2a2bf20a68a967145fe1a7b2337a997/python/pyarrow/parquet.py#L1891

which internally calls the helper function _mkdir_if_not_exists()

https://github.com/apache/arrow/blob/e2238582e2a2bf20a68a967145fe1a7b2337a997/python/pyarrow/parquet.py#L1883

The problem is that for FTPFileSystem, this helper function does not actually create the directory because of this line

https://github.com/intake/filesystem_spec/blob/85bb2f3fef2aa12f7ec8497ea116c78c644b49ec/fsspec/spec.py#L1219

The simplest solution would be to override this _is_filestore() method in FTPFileSystem to return True.

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 with _is_filestore() in fsspec/spec.py and trace how FTPFileSystem reaches it during pandas to_parquet(), including pyarrow's _mkdir_if_not_exists() helper. Verify the directory is created for partitioned parquet output on FTPFileSystem and add or update coverage if the repository has a relevant test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.