vikrambohra commented on code in PR #3643:
URL: https://github.com/apache/gobblin/pull/3643#discussion_r1116248412
##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergCatalogFactory.java:
##########
@@ -17,20 +17,26 @@
package org.apache.gobblin.data.management.copy.iceberg;
+import java.io.IOException;
+import java.util.Map;
+
import org.apache.hadoop.conf.Configuration;
-import org.apache.iceberg.hive.HiveCatalog;
+import org.apache.iceberg.CatalogUtil;
+import org.apache.iceberg.catalog.Catalog;
-import com.google.common.collect.Maps;
+import org.apache.gobblin.util.reflection.GobblinConstructorUtils;
/**
* Provides an {@link IcebergCatalog}.
*/
public class IcebergCatalogFactory {
- public static IcebergCatalog create(Configuration configuration) {
- HiveCatalog hcat = new HiveCatalog();
- hcat.setConf(configuration);
- hcat.initialize("hive", Maps.newHashMap());
- return new IcebergHiveCatalog(hcat);
+ public static IcebergCatalog create(IcebergCatalog.CatalogSpecifier
specifier, Map<String, String> properties, Configuration configuration) throws
IOException {
+ try {
+ Catalog catalog =
CatalogUtil.loadCatalog(specifier.getCatalogClass().getName(),
specifier.getCatalogName(), properties, configuration);
+ return
GobblinConstructorUtils.invokeLongestConstructor(specifier.getIcebergCatalogClass(),
catalog);
Review Comment:
I'd suggest you call the exact constructor instead of longest constructor so
as to avoid passing in nulls/empty strings as more params are added to the
constructor.
--
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]