Fokko commented on code in PR #5747:
URL: https://github.com/apache/iceberg/pull/5747#discussion_r972589166
##########
python/pyiceberg/io/pyarrow.py:
##########
@@ -165,6 +169,24 @@ def to_input_file(self) -> "PyArrowFile":
class PyArrowFileIO(FileIO):
+ def __init__(self, properties: Properties = EMPTY_DICT):
+ self.get_fs_and_path: Callable = lru_cache(self._get_fs_and_path)
+ super().__init__(properties=properties)
+
+ def _get_fs_and_path(self, location: str) -> Tuple[FileSystem, str]:
+ uri = urlparse(location) # Create a ParseResult from the URI
+ if not uri.scheme: # If no scheme, assume the path is to a local file
+ return FileSystem.from_uri(os.path.abspath(location))
+ elif uri.scheme in {"s3", "s3a", "s3n"}:
+ client_kwargs = {
+ "endpoint_override": self.properties.get("s3.endpoint"),
Review Comment:
Ah, I missed that, it just works when checking out your branch:
```
➜ python git:(pyarrow_s3) ✗ cat ~/.pyiceberg.yaml
catalog:
hive:
uri: thrift://10.10.1.120:9083
s3.endpoint: http://10.10.1.120:9000
s3.access-key-id: admin
s3.secret-access-key: password
➜ python git:(pyarrow_s3) ✗
PYICEBERG_CATALOG__HIVE__PY_IO_IMPL=pyiceberg.io.fsspec.FsspecFileIO pyiceberg
--catalog hive files nyc.taxis
Snapshots: nyc.taxis
└── Snapshot 4156884266726949592, schema 0:
s3a://warehouse/wh/nyc.db/taxis/metadata/snap-4156884266726949592-1-b8de0d21-c30d-4e9a-a2a2-a0caad638cdc.avro
└── Manifest:
s3a://warehouse/wh/nyc.db/taxis/metadata/b8de0d21-c30d-4e9a-a2a2-a0caad638cdc-m0.avro
└── Datafile:
s3a://warehouse/wh/nyc.db/taxis/data/00003-4-21c9e89f-8aa0-4756-a689-491063ef0dd6-00001.parquet
➜ python git:(pyarrow_s3) ✗
PYICEBERG_CATALOG__HIVE__PY_IO_IMPL=pyiceberg.io.pyarrow.PyArrowFileIO
pyiceberg --catalog hive files nyc.taxis
Snapshots: nyc.taxis
└── Snapshot 4156884266726949592, schema 0:
s3a://warehouse/wh/nyc.db/taxis/metadata/snap-4156884266726949592-1-b8de0d21-c30d-4e9a-a2a2-a0caad638cdc.avro
└── Manifest:
s3a://warehouse/wh/nyc.db/taxis/metadata/b8de0d21-c30d-4e9a-a2a2-a0caad638cdc-m0.avro
└── Datafile:
s3a://warehouse/wh/nyc.db/taxis/data/00003-4-21c9e89f-8aa0-4756-a689-491063ef0dd6-00001.parquet
```
Thanks for the context, I think this if fine as is for now 👍🏻
--
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]