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 2021/02/04 10:30:51 UTC

[GitHub] [iceberg] lcspinter commented on a change in pull request #2129: Hive: Configure catalog type on table level.

lcspinter commented on a change in pull request #2129:
URL: https://github.com/apache/iceberg/pull/2129#discussion_r570114005



##########
File path: hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalogs.java
##########
@@ -36,4 +38,11 @@ public static HiveCatalog loadCatalog(Configuration conf) {
     String metastoreUri = conf.get(HiveConf.ConfVars.METASTOREURIS.varname, "");
     return CATALOG_CACHE.get(metastoreUri, uri -> new HiveCatalog(conf));
   }
+
+  public static HiveCatalog loadCatalog(String catalogName, Map<String, String> properties, Configuration conf) {
+    // metastore URI can be null in local mode
+    String metastoreUri = conf.get(HiveConf.ConfVars.METASTOREURIS.varname, "");
+    return CATALOG_CACHE.get(metastoreUri, uri -> (HiveCatalog) CatalogUtil.loadCatalog(HiveCatalog.class.getName(),
+            catalogName, properties, conf));
+  }

Review comment:
       The plan is to remove the `HiveCatalogs` completely but in a separate PR. I would like to keep it for time being, because of it's caching mechanism. Without it, we would need to create a new Hive client every time the `loadTable()`, `createTable()` or `dropTable()` is called, which is really expansive.
   
   In a different PR, I will work on introducing a more general cache (not just for Hive catalogs), similar to `CustomCatalogs` cache. 




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