nastra commented on code in PR #13241: URL: https://github.com/apache/iceberg/pull/13241#discussion_r2164119918
########## 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; + } + } + prefixedADLSClient = clientByPrefix().getOrDefault(matchingPrefix, null); - private DataLakeFileClient fileClient(String path) { - ADLSLocation location = new ADLSLocation(path); - return client(location).getFileClient(location.path()); + Preconditions.checkState( + null != prefixedADLSClient, + "[BUG] ADLS client-builder for storage path not available: %s", Review Comment: btw we're using the same logging pattern (which I added) in `S3FileIO` and `GcsFileIO` -- 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