You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/09/15 17:39:53 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #5747: PyArrow support for S3/S3A with properties

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


##########
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:
   Should we split the schema out of this? For `fsspec` this would be set to `http://192.168.1.77:9000`, however, for the S3FileSystem we need to split this out to `scheme` and `endpoint_override`:
   <img width="497" alt="image" src="https://user-images.githubusercontent.com/1134248/190473159-154b0e12-d6f9-438c-bcd8-efc4890ca8ff.png">
   
   This way we don't have FS specific configuration.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org