mccormickt12 commented on code in PR #2251:
URL: https://github.com/apache/iceberg-python/pull/2251#discussion_r2240363765


##########
pyiceberg/io/pyarrow.py:
##########
@@ -512,59 +597,111 @@ def _initialize_azure_fs(self) -> FileSystem:
 
         from pyarrow.fs import AzureFileSystem
 
-        client_kwargs: Dict[str, str] = {}
-
-        if account_name := self.properties.get(ADLS_ACCOUNT_NAME):
-            client_kwargs["account_name"] = account_name
-
-        if account_key := self.properties.get(ADLS_ACCOUNT_KEY):
-            client_kwargs["account_key"] = account_key
-
-        if blob_storage_authority := 
self.properties.get(ADLS_BLOB_STORAGE_AUTHORITY):
-            client_kwargs["blob_storage_authority"] = blob_storage_authority
+        # Mapping from PyIceberg properties to AzureFileSystem parameter names
+        property_mapping = {
+            ADLS_ACCOUNT_NAME: "account_name",
+            ADLS_ACCOUNT_KEY: "account_key",
+            ADLS_BLOB_STORAGE_AUTHORITY: "blob_storage_authority",
+            ADLS_DFS_STORAGE_AUTHORITY: "dfs_storage_authority",
+            ADLS_BLOB_STORAGE_SCHEME: "blob_storage_scheme",
+            ADLS_DFS_STORAGE_SCHEME: "dfs_storage_scheme",
+            ADLS_SAS_TOKEN: "sas_token",
+        }
 
-        if dfs_storage_authority := 
self.properties.get(ADLS_DFS_STORAGE_AUTHORITY):
-            client_kwargs["dfs_storage_authority"] = dfs_storage_authority
+        client_kwargs: Dict[str, Any] = {}
 
-        if blob_storage_scheme := 
self.properties.get(ADLS_BLOB_STORAGE_SCHEME):
-            client_kwargs["blob_storage_scheme"] = blob_storage_scheme
+        for prop_name, prop_value in self.properties.items():
+            if prop_value is None:
+                continue
 
-        if dfs_storage_scheme := self.properties.get(ADLS_DFS_STORAGE_SCHEME):
-            client_kwargs["dfs_storage_scheme"] = dfs_storage_scheme
+            # Map known property names to AzureFileSystem parameter names
+            if prop_name in property_mapping:
+                param_name = property_mapping[prop_name]
+                client_kwargs[param_name] = prop_value
 
-        if sas_token := self.properties.get(ADLS_SAS_TOKEN):
-            client_kwargs["sas_token"] = sas_token
+            # Pass through any other adls.* properties that might be used by 
AzureFileSystem
+            elif prop_name.startswith("adls."):
+                param_name = prop_name.split(".", 1)[1]
+                client_kwargs[param_name] = prop_value
 
         return AzureFileSystem(**client_kwargs)
 
     def _initialize_hdfs_fs(self, scheme: str, netloc: Optional[str]) -> 
FileSystem:
         from pyarrow.fs import HadoopFileSystem
 
-        hdfs_kwargs: Dict[str, Any] = {}
         if netloc:
             return HadoopFileSystem.from_uri(f"{scheme}://{netloc}")
-        if host := self.properties.get(HDFS_HOST):
-            hdfs_kwargs["host"] = host
-        if port := self.properties.get(HDFS_PORT):
-            # port should be an integer type
-            hdfs_kwargs["port"] = int(port)
-        if user := self.properties.get(HDFS_USER):
-            hdfs_kwargs["user"] = user
-        if kerb_ticket := self.properties.get(HDFS_KERB_TICKET):
-            hdfs_kwargs["kerb_ticket"] = kerb_ticket
+
+        # Mapping from PyIceberg properties to S3FileSystem parameter names

Review Comment:
   function is hdfs but comment is s3, typo?



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