-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Currently, when passing a URI to a filesystem method (except for from_uri) or other functions that accept a filesystem object, you can get a rather cryptic error message (eg in this case about "No response body" for S3, in the example below).
Ideally, the filesystem object knows its own prefix "scheme", and so can detect if a user is passing a URI instead of file path, and we can provide a nicer error message.
Example with S3:
>>> from pyarrow.fs import S3FileSystem
>>> fs = S3FileSystem(region="us-east-2")
>>> fs.get_file_info('s3://ursa-labs-taxi-data/2016/01/')
...
OSError: When getting information for key '/ursa-labs-taxi-data/2016/01' in bucket 's3:': AWS Error [code 100]: No response body.
>>> import pyarrow.parquet as pq
>>> table = pq.read_table('s3://ursa-labs-taxi-data/2016/01/data.parquet', filesystem=fs)
...
OSError: When getting information for key '/ursa-labs-taxi-data/2016/01/data.parquet' in bucket 's3:': AWS Error [code 100]: No response body.With a local filesystem, you actually get a not found file:
>>> fs = LocalFileSystem()
>>> fs.get_file_info("file:///home")
<FileInfo for 'file:///home': type=FileType.NotFound>cc @pitrou
Reporter: Joris Van den Bossche / @jorisvandenbossche
Assignee: Antoine Pitrou / @pitrou
Related issues:
- [Python] ArrowInvalid error on reading partitioned parquet files from S3 (arrow-2.0.0) (is related to)
PRs and other links:
Note: This issue was originally created as ARROW-10998. Please see the migration documentation for further details.