You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/10/22 21:01:26 UTC

[GitHub] [iceberg] giovannifumarola commented on a change in pull request #1640: Allow loading custom Catalog implementation in Spark and Flink

giovannifumarola commented on a change in pull request #1640:
URL: https://github.com/apache/iceberg/pull/1640#discussion_r510453213



##########
File path: flink/src/main/java/org/apache/iceberg/flink/FlinkCatalogFactory.java
##########
@@ -79,6 +80,10 @@ protected CatalogLoader createCatalogLoader(String name, Map<String, String> pro
         String warehouseLocation = properties.get(HADOOP_WAREHOUSE_LOCATION);
         return CatalogLoader.hadoop(name, hadoopConf, warehouseLocation);
 
+      case "custom":

Review comment:
       NIT: Avoid hard code it

##########
File path: flink/src/main/java/org/apache/iceberg/flink/CatalogLoader.java
##########
@@ -94,4 +100,47 @@ public String toString() {
           .toString();
     }
   }
+
+  class CustomCatalogLoader implements CatalogLoader {
+
+    private final SerializableConfiguration hadoopConf;
+    private final String name;
+    private final String impl;
+
+    private CustomCatalogLoader(String name, Configuration conf, String impl) {
+      this.hadoopConf = new SerializableConfiguration(conf);
+      this.name = name;
+      this.impl = Preconditions.checkNotNull(impl,
+          "Cannot initialize custom Catalog because impl property is not set");
+    }
+
+    @Override
+    public Catalog loadCatalog() {

Review comment:
       Maybe this method can be static and be called from other places.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org