rymurr commented on a change in pull request #1875:
URL: https://github.com/apache/iceberg/pull/1875#discussion_r547525143



##########
File path: spark3/src/main/java/org/apache/iceberg/spark/SparkCatalog.java
##########
@@ -101,27 +94,7 @@
    */
   protected Catalog buildIcebergCatalog(String name, CaseInsensitiveStringMap 
options) {
     Configuration conf = SparkSession.active().sessionState().newHadoopConf();
-
-    String catalogImpl = options.get(CatalogProperties.CATALOG_IMPL);
-    if (catalogImpl != null) {
-      return CatalogUtil.loadCatalog(catalogImpl, name, options, conf);
-    }
-
-    String catalogType = options.getOrDefault(ICEBERG_CATALOG_TYPE, 
ICEBERG_CATALOG_TYPE_HIVE);
-    switch (catalogType.toLowerCase(Locale.ENGLISH)) {
-      case ICEBERG_CATALOG_TYPE_HIVE:
-        int clientPoolSize = 
options.getInt(CatalogProperties.HIVE_CLIENT_POOL_SIZE,
-            CatalogProperties.HIVE_CLIENT_POOL_SIZE_DEFAULT);
-        String uri = options.get(CatalogProperties.HIVE_URI);
-        return new HiveCatalog(name, uri, clientPoolSize, conf);
-
-      case ICEBERG_CATALOG_TYPE_HADOOP:
-        String warehouseLocation = 
options.get(CatalogProperties.WAREHOUSE_LOCATION);
-        return new HadoopCatalog(name, conf, warehouseLocation, 
options.asCaseSensitiveMap());
-
-      default:
-        throw new UnsupportedOperationException("Unknown catalog type: " + 
catalogType);
-    }
+    return CatalogUtil.buildIcebergCatalog(name, options.asCaseSensitiveMap(), 
conf);

Review comment:
       good catch, fixed




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

Reply via email to