rymurr commented on code in PR #14966:
URL: https://github.com/apache/iceberg/pull/14966#discussion_r2707753640


##########
azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSFileIO.java:
##########
@@ -70,6 +73,27 @@ public ADLSFileIO() {}
     this.azureProperties = azureProperties;
   }
 
+  /**
+   * Constructor with custom DataLakeFileSystemClient supplier.
+   *
+   * <p>Calling {@link ADLSFileIO#initialize(Map)} will overwrite the 
properties and azureProperties
+   * set in this constructor, but the clientSupplier will continue to be used.
+   *
+   * <p>Unlike the no-arg constructor, this constructor initializes properties 
and azureProperties
+   * immediately, allowing immediate use without calling {@link 
ADLSFileIO#initialize(Map)}.
+   *
+   * <p>Note: The provided client will be used for all file system operations. 
If your use case
+   * requires accessing multiple containers, ensure the client is configured 
appropriately or use
+   * the default constructor with {@link ADLSFileIO#initialize(Map)}.
+   *
+   * @param clientSupplier client supplier
+   */
+  public ADLSFileIO(SerializableSupplier<DataLakeFileSystemClient> 
clientSupplier) {
+    this.clientSupplier = clientSupplier;
+    this.properties = SerializableMap.copyOf(Maps.newHashMap());

Review Comment:
   if that is the case would it be better to call `initialize` from the 
constructor. To make the contract more clear and ensure if we change 
`initialize` we don't have to change the constructo



##########
azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSFileIO.java:
##########
@@ -109,6 +131,16 @@ public DataLakeFileSystemClient client(String path) {
 
   @VisibleForTesting
   DataLakeFileSystemClient client(ADLSLocation location) {
+    if (clientSupplier != null) {

Review Comment:
   this means you can't use the client with multiple `location`s now. I think 
you have to handle a single client per location



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