diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java index f2bd5b5f999c..73d4e461c0fc 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java @@ -23,6 +23,7 @@ import java.util.Optional; import java.util.Properties; import java.util.Set; +import java.util.function.UnaryOperator; import org.apache.hadoop.conf.Configuration; import org.apache.iceberg.CatalogProperties; import org.apache.iceberg.CatalogUtil; @@ -183,7 +184,11 @@ public static boolean dropTable(Configuration conf, Properties props) { * @return true if the Catalog is HiveCatalog */ public static boolean hiveCatalog(Configuration conf, Properties props) { - String catalogName = props.getProperty(InputFormatConfig.CATALOG_NAME); + return hiveCatalog(conf, props::getProperty); + } + + public static boolean hiveCatalog(Configuration conf, UnaryOperator props) { + String catalogName = props.apply(InputFormatConfig.CATALOG_NAME); String catalogType = getCatalogType(conf, catalogName); if (catalogType != null) { return CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE.equalsIgnoreCase(catalogType); diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java index adc356446cd2..c1e0dafb6693 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java @@ -2003,7 +2003,8 @@ public List getPartitions(org.apache.hadoop.hive.ql.metadata.Table ta } public boolean isPartitioned(org.apache.hadoop.hive.ql.metadata.Table hmsTable) { - if (hmsTable.getSd().getLocation() == null) { + if (!Catalogs.hiveCatalog(conf, hmsTable::getProperty) || + hmsTable.getSd().getLocation() == null) { return false; } Table table = IcebergTableUtil.getTable(conf, hmsTable.getTTable());