rdblue commented on a change in pull request #1618:
URL: https://github.com/apache/iceberg/pull/1618#discussion_r509519226
##########
File path: core/src/main/java/org/apache/iceberg/CatalogUtil.java
##########
@@ -117,4 +120,42 @@ private static void deleteFiles(FileIO io,
Set<ManifestFile> allManifests) {
}
});
}
+
+ /**
+ * Load FileIO, default to HadoopFileIO
+ * @param tableMetadata table metadata
+ * @param conf Hadoop configuration
+ * @return FileIO class
+ * @throws IllegalArgumentException if class path not found or
+ * right constructor not found or
+ * the loaded class cannot be casted to the given interface type
+ */
+ public static FileIO loadFileIO(TableMetadata tableMetadata, Configuration
conf) {
+ if (tableMetadata != null) {
+ Map<String, String> properties = tableMetadata.properties();
+ if (properties.containsKey(TableProperties.WRITE_FILE_IO_IMPL)) {
+ String impl = properties.get(TableProperties.WRITE_FILE_IO_IMPL);
+ LOG.info("Loading custom FileIO implementation: {}", impl);
+ DynConstructors.Ctor<FileIO> ctor;
+ try {
+ ctor = DynConstructors.builder(FileIO.class)
+ .impl(impl, Configuration.class)
Review comment:
I think it would make sense to add an alternative constructor that
accepts `Map` to pass the table properties. We can do this in a follow-up when
it's needed, or here if you agree.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]