[Python] ArrowInvalid error on reading partitioned parquet files with fsspec.adlfs (pyarrow-7.0.0) due to removed '/' in the ls of path
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 91
Description
Reading a partitioned parquet from adlfs with pyarrow through pandas will throw unnecessary exceptions on not matching forward slashes in the listed files returned from adlfs, ie:
```python
import pandas as pd
pd.read_parquet("adl://resource/path/to/parquet/files")
```
results in exception of the form
```bash
pyarrow.lib.ArrowInvalid: GetFileInfo() yielded path 'path/to/parquet/files/part-0001.parquet', which is outside base dir '/path/to/parquet/files/'
```
and testing with modifying the adlfs method to prepend slashes to all returned files, we still end up with an error on file paths that would otherwise be handled correctly where there is a double slash in a location where there should be one, ie:
```python
import pandas as pd
pd.read_parquet("adl://resource/path/to//parquet/files")
```
would throw
```bash
pyarrow.lib.ArrowInvalid: GetFileInfo() yielded path '/path/to/parquet/files/part-0001.parquet', which is outside base dir '/path/to//parquet/files/'
```
In both cases the ls has returned correctly from adlfs, given it's discovered the file part-0001.parquet but the pyarrow exception stops what could otherwise be successful processing.
**Reporter**: [Jon Rosenberg](https://issues.apache.org/jira/browse/ARROW-16077)
**Note**: *This issue was originally created as [ARROW-16077](https://issues.apache.org/jira/browse/ARROW-16077). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Contributor guide
Research direction
Start by reproducing the two pd.read_parquet examples against partitioned files served through adlfs and pyarrow 7.0.0, comparing paths with missing, doubled, and normal forward slashes. Trace the file listing and GetFileInfo path handling; done means valid listings no longer raise ArrowInvalid while genuinely out-of-base paths remain rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100