Fokko opened a new issue, #5728:
URL: https://github.com/apache/iceberg/issues/5728
### Feature Request / Improvement
For PyIceberg, we want to catch the exceptions thrown by s3fs/pyarrow/etc
and turn them into a pyiceberg exception:
```
>>> catalog.load_table(('nyc', 'taxis'))
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/s3fs/core.py", line 110,
in _error_wrapper
return await func(*args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/aiobotocore/client.py",
line 265, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (403) when calling the
HeadObject operation: Forbidden
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/Users/fokkodriesprong/Desktop/iceberg/python/pyiceberg/catalog/hive.py", line
356, in load_table
return self._convert_hive_into_iceberg(hive_table, io)
File
"/Users/fokkodriesprong/Desktop/iceberg/python/pyiceberg/catalog/hive.py", line
257, in _convert_hive_into_iceberg
metadata = FromInputFile.table_metadata(file)
File
"/Users/fokkodriesprong/Desktop/iceberg/python/pyiceberg/serializers.py", line
56, in table_metadata
with input_file.open() as input_stream:
File
"/Users/fokkodriesprong/Desktop/iceberg/python/pyiceberg/io/fsspec.py", line
80, in open
return self._fs.open(self.location, "rb")
File "/opt/homebrew/lib/python3.10/site-packages/fsspec/spec.py", line
1037, in open
f = self._open(
File "/opt/homebrew/lib/python3.10/site-packages/s3fs/core.py", line 605,
in _open
return S3File(
File "/opt/homebrew/lib/python3.10/site-packages/s3fs/core.py", line 1911,
in __init__
super().__init__(
File "/opt/homebrew/lib/python3.10/site-packages/fsspec/spec.py", line
1385, in __init__
self.size = self.details["size"]
File "/opt/homebrew/lib/python3.10/site-packages/fsspec/spec.py", line
1398, in details
self._details = self.fs.info(self.path)
File "/opt/homebrew/lib/python3.10/site-packages/fsspec/asyn.py", line 86,
in wrapper
return sync(self.loop, func, *args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/fsspec/asyn.py", line 66,
in sync
raise return_result
File "/opt/homebrew/lib/python3.10/site-packages/fsspec/asyn.py", line 26,
in _runner
result[0] = await coro
File "/opt/homebrew/lib/python3.10/site-packages/s3fs/core.py", line 1140,
in _info
out = await self._call_s3(
File "/opt/homebrew/lib/python3.10/site-packages/s3fs/core.py", line 332,
in _call_s3
return await _error_wrapper(
File "/opt/homebrew/lib/python3.10/site-packages/s3fs/core.py", line 137,
in _error_wrapper
raise err
PermissionError: Forbidden
```
This makes it easier for the end-user to handle the exceptions, and doesn't
have to care about the implementation details
### Query engine
Other
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]