joshuarobinson commented on code in PR #5747:
URL: https://github.com/apache/iceberg/pull/5747#discussion_r972183165


##########
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"}:

Review Comment:
   I suspect we'll want to do that in the future, but I don't know enough about 
either to what schemes we need to match on and what properties to pass through. 
(I've personally only ever worked with file:// and s3://)
   
   Perhaps it makes sense to do that in a later PR?



##########
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"}:

Review Comment:
   I suspect we'll want to do that in the future, but I don't know enough about 
either to know what schemes we need to match on and what properties to pass 
through. (I've personally only ever worked with file:// and s3://)
   
   Perhaps it makes sense to do that in a later PR?



-- 
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]

Reply via email to