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



##########
File path: mr/src/main/java/org/apache/iceberg/mr/Catalogs.java
##########
@@ -212,11 +212,28 @@ public static boolean hiveCatalog(Configuration conf, 
Properties props) {
       return Optional.empty();
     } else {
       String name = catalogName == null ? ICEBERG_DEFAULT_CATALOG_NAME : 
catalogName;
+
+      if (catalogType != null && isCustomCatalogSet(conf, catalogName)) {
+        throw new IllegalArgumentException(String.format("Provide only one of 
the following configs: '%s' or '%s'",
+                CatalogUtil.ICEBERG_CATALOG_TYPE, 
CatalogProperties.CATALOG_IMPL));
+      }
+
       return Optional.of(CatalogUtil.buildIcebergCatalog(name,
               getCatalogProperties(conf, name, catalogType), conf));
     }
   }
 
+  /**
+   * Returns true if {@link CatalogProperties#CATALOG_IMPL} is set.
+   * @param conf global hive configuration
+   * @param catalogName name of the catalog
+   * @return true if {@link CatalogProperties#CATALOG_IMPL} is set
+   */
+  private static boolean isCustomCatalogSet(Configuration conf, String 
catalogName) {

Review comment:
       If this is not reused, we might want to put the code where the method is 
called now




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