deniskuzZ commented on code in PR #5995:
URL: https://github.com/apache/hive/pull/5995#discussion_r2320337203


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java:
##########
@@ -195,29 +189,29 @@ public static boolean dropTable(Configuration conf, 
Properties props) {
    */
   public static boolean hiveCatalog(Configuration conf, Properties props) {
     String catalogName = props.getProperty(InputFormatConfig.CATALOG_NAME);
-    String catalogType = getCatalogType(conf, catalogName);
+    String catalogType = CatalogUtils.getCatalogType(conf, catalogName);

Review Comment:
   could be simplified by removing code duplication
   ````
   public static boolean hiveCatalog(Configuration conf, Properties props) {
     return assertCatalogType(conf, props, 
CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE, null);
   }
   
   public static boolean hadoopCatalog(Configuration conf, Properties props) {
     return assertCatalogType(conf, props, 
CatalogUtil.ICEBERG_CATALOG_TYPE_HADOOP, CatalogUtil.ICEBERG_CATALOG_HADOOP);
   }
   
   public static boolean assertCatalogType(Configuration conf, Properties props,
         String expectedType, String expectedImpl) {
     String catalogName = props.getProperty(InputFormatConfig.CATALOG_NAME);
     String catalogType = Optional.ofNullable(CatalogUtils.getCatalogType(conf, 
catalogName))
         .orElseGet(() -> CatalogUtils.getCatalogType(conf, 
ICEBERG_DEFAULT_CATALOG_NAME));
     if (catalogType != null) {
       return expectedType.equalsIgnoreCase(catalogType);
     }
     return StringUtils.equals(expectedImpl, 
CatalogUtils.getCatalogProperties(conf, catalogName)
         .get(CatalogProperties.CATALOG_IMPL));
   }
   ````



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to