nastra commented on code in PR #13241:
URL: https://github.com/apache/iceberg/pull/13241#discussion_r2165970541


##########
azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSFileIO.java:
##########
@@ -103,37 +102,32 @@ public Map<String, String> properties() {
   }
 
   public DataLakeFileSystemClient client(String path) {
-    ADLSLocation location = new ADLSLocation(path);
-    return client(location);
+    return clientForStoragePath(path).client(path);

Review Comment:
   it feels weird to have to pass the `path` twice



##########
azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSFileIO.java:
##########
@@ -103,37 +102,32 @@ public Map<String, String> properties() {
   }
 
   public DataLakeFileSystemClient client(String path) {
-    ADLSLocation location = new ADLSLocation(path);
-    return client(location);
+    return clientForStoragePath(path).client(path);
   }
 
   @VisibleForTesting
-  DataLakeFileSystemClient client(ADLSLocation location) {
-    DataLakeFileSystemClientBuilder clientBuilder =
-        new DataLakeFileSystemClientBuilder().httpClient(HTTP);
-
-    location.container().ifPresent(clientBuilder::fileSystemName);
-    Optional.ofNullable(vendedAdlsCredentialProvider)
-        .map(p -> new VendedAzureSasCredentialPolicy(location.host(), p))
-        .ifPresent(clientBuilder::addPolicy);
-    azureProperties.applyClientConfiguration(location.host(), clientBuilder);
+  PrefixedADLSClient clientForStoragePath(String path) {
+    PrefixedADLSClient prefixedADLSClient;
+    String matchingPrefix = ABFS_PREFIX;
 
-    return clientBuilder.buildClient();
-  }
+    for (String storagePrefix : clientByPrefix().keySet()) {
+      if (path.startsWith(storagePrefix) && storagePrefix.length() > 
matchingPrefix.length()) {
+        matchingPrefix = storagePrefix;
+      }
+    }

Review Comment:
   newline after this



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to