sungwy commented on code in PR #1043:
URL: https://github.com/apache/iceberg-python/pull/1043#discussion_r1717484170
##########
pyiceberg/io/pyarrow.py:
##########
@@ -1308,6 +1309,192 @@ def _read_all_delete_files(fs: FileSystem, tasks:
Iterable[FileScanTask]) -> Dic
return deletes_per_file
+def _fs_from_file_path(file_path: str, io: FileIO) -> FileSystem:
+ scheme, netloc, _ = _parse_location(file_path)
+ if isinstance(io, PyArrowFileIO):
+ return io.fs_by_scheme(scheme, netloc)
+ else:
+ try:
+ from pyiceberg.io.fsspec import FsspecFileIO
+
+ if isinstance(io, FsspecFileIO):
+ from pyarrow.fs import PyFileSystem
+
+ return PyFileSystem(FSSpecHandler(io.get_fs(scheme)))
+ else:
+ raise ValueError(f"Expected PyArrowFileIO or FsspecFileIO,
got: {io}")
+ except ModuleNotFoundError as e:
+ # When FsSpec is not installed
+ raise ValueError(f"Expected PyArrowFileIO or FsspecFileIO, got:
{io}") from e
Review Comment:
Yes, copied it over since it'll be deprecated!
--
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]