yf-yang commented on issue #38794:
URL: https://github.com/apache/arrow/issues/38794#issuecomment-1819038094
@mapleFU As I learned from some stack overflow answers, I did try to use
different prefix with the path, for example,
## without `s3://`
``` python
pq.ParquetDataset('bucket/parquet_root/', filesystem=s3fs,
partitioning=ds.DirectoryPartitioning(pa.schema([("set", pa.string()),
("subset", pa.string())])))
# FileNotFoundError: bucket/parquet_root/
```
## or, with a prefix `/` only
``` python
pq.ParquetDataset('/bucket/parquet_root/', filesystem=s3fs,
partitioning=ds.DirectoryPartitioning(pa.schema([("set", pa.string()),
("subset", pa.string())])))
# pyarrow.lib.ArrowInvalid: GetFileInfo() yielded path
'bucket/parquet_root/abc/def/part-0.parquet', which is outside base dir
'/bucket/parquet_root/'
```
---
https://github.com/apache/arrow/issues/26864#issuecomment-1377982984 works
because as I shown in the issue:
>
pq.read_table('bucket/parquet_root/abc/def/part-0.parquet',filesystem=s3fs) # ok
>
pq.read_table('s3://bucket/parquet_root/abc/def/part-0.parquet',filesystem=s3fs)
# ok
Both approach is OK, so with the flag `use_pandas_metadata=True` the call is
also OK. However, I still do not know what to do with a partitioned dataset.
---
I also tried to reproduce
https://github.com/apache/arrow/issues/26864#issuecomment-1377982966
``` python
from pyarrow.fs import FileSelector, PyFileSystem, FSSpecHandler
fs = PyFileSystem(FSSpecHandler(s3fs))
selector = FileSelector("s3://bucket/parquet_root/", recursive=True)
fs.get_file_info(selector)
```
It returns
``` python
[
<FileInfo for 'bucket/parquet_root': type=FileType.Directory>,
<FileInfo for 'bucket/parquet_root/': type=FileType.File, size=0>,
<FileInfo for 'bucket/parquet_root/abc': type=FileType.Directory>,
<FileInfo for 'bucket/parquet_root/abc/': type=FileType.File, size=0>,
<FileInfo for 'bucket/parquet_root/abc/def': type=FileType.Directory>,
<FileInfo for 'bucket/parquet_root/abc/def/': type=FileType.File, size=0>,
<FileInfo for 'bucket/parquet_root/abc/def/part-0.parquet':
type=FileType.File, size=1078092>
]
```
Not sure if it helps
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]