rdblue commented on a change in pull request #3162:
URL: https://github.com/apache/iceberg/pull/3162#discussion_r726227811



##########
File path: core/src/main/java/org/apache/iceberg/CatalogUtil.java
##########
@@ -208,21 +208,24 @@ public static Catalog loadCatalog(
    */
   public static Catalog buildIcebergCatalog(String name, Map<String, String> 
options, Configuration conf) {
     String catalogImpl = options.get(CatalogProperties.CATALOG_IMPL);
-    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);
-      }
+    if (catalogImpl != null) {
+      Preconditions.checkArgument(!options.containsKey(ICEBERG_CATALOG_TYPE),
+          "Provide only one of the following configs: '%s' or '%s'",

Review comment:
       It is good that this message is direct, but we prefer to include what 
went wrong. Iceberg error messages are typically of the form "Cannot 
(something) (problem): (helpful context)" or "Invalid (something) (reason): 
(the invalid thing)"
   
   Here, I would expect `"Cannot create catalog %s, both type and catalog-impl 
are set: type=%s, catalog-impl=%s", name, catalogType, catalogImpl`




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