jackye1995 commented on a change in pull request #3590:
URL: https://github.com/apache/iceberg/pull/3590#discussion_r756382868



##########
File path: core/src/main/java/org/apache/iceberg/CatalogUtil.java
##########
@@ -266,11 +264,76 @@ public static FileIO loadFileIO(
           String.format("Cannot initialize FileIO, %s does not implement 
FileIO.", impl), e);
     }
 
-    if (fileIO instanceof Configurable) {
-      ((Configurable) fileIO).setConf(hadoopConf);
-    }
+    configureHadoopConf(fileIO, hadoopConf);
 
     fileIO.initialize(properties);
     return fileIO;
   }
+
+  /**
+   * Dynamically detects whether an object is a Hadoop Configurable and calls 
setConf.
+   * @param maybeConfigurable an object that may be Configurable
+   * @param conf a Configuration
+   */
+  @SuppressWarnings("unchecked")
+  public static void configureHadoopConf(Object maybeConfigurable, Object 
conf) {

Review comment:
       it is unclear to me how users would use it outside `loadCatalog` and 
`loadFileIO`, but maybe I am missing some use cases, so it's up to you.




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