harshm-dev commented on a change in pull request #3326:
URL: https://github.com/apache/iceberg/pull/3326#discussion_r732776781



##########
File path: core/src/main/java/org/apache/iceberg/CatalogUtil.java
##########
@@ -208,23 +201,14 @@ public static Catalog loadCatalog(
    */
   public static Catalog buildIcebergCatalog(String name, Map<String, String> 
options, Configuration conf) {
     String catalogImpl = options.get(CatalogProperties.CATALOG_IMPL);
+    String catalogType = options.get(CatalogProperties.CATALOG_TYPE);
+    Preconditions.checkArgument(catalogImpl == null || catalogType == null,
+            "Cannot create catalog %s, both type and catalog-impl are set: 
type=%s, catalog-impl=%s",
+            name, catalogType, catalogImpl);
+
     if (catalogImpl == null) {
-      String catalogType = PropertyUtil.propertyAsString(options, 
ICEBERG_CATALOG_TYPE, ICEBERG_CATALOG_TYPE_HIVE);
-      switch (catalogType.toLowerCase(Locale.ENGLISH)) {
-        case ICEBERG_CATALOG_TYPE_HIVE:
-          catalogImpl = ICEBERG_CATALOG_HIVE;
-          break;
-        case ICEBERG_CATALOG_TYPE_HADOOP:
-          catalogImpl = ICEBERG_CATALOG_HADOOP;
-          break;
-        default:
-          throw new UnsupportedOperationException("Unknown catalog type: " + 
catalogType);
-      }
-    } else {
-      String catalogType = options.get(ICEBERG_CATALOG_TYPE);
-      Preconditions.checkArgument(catalogType == null,
-          "Cannot create catalog %s, both type and catalog-impl are set: 
type=%s, catalog-impl=%s",
-          name, catalogType, catalogImpl);
+      catalogType = (catalogType == null) ? CatalogType.HIVE.typeName() : 
catalogType;

Review comment:
       The current behaviour is to default to hive catalog if both are null. 
Just retaining that - 
[CatalogUtil.java#L212](https://github.com/apache/iceberg/blob/d72851e551e193ec2eee7aeecc6a94a7e7e94f6e/core/src/main/java/org/apache/iceberg/CatalogUtil.java#L212)




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to