Skip to content

Commit

Permalink
support only hive catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskuzZ committed Oct 10, 2024
1 parent 60e821a commit b4671b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> props) {
String catalogName = props.apply(InputFormatConfig.CATALOG_NAME);
String catalogType = getCatalogType(conf, catalogName);
if (catalogType != null) {
return CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE.equalsIgnoreCase(catalogType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,8 @@ public List<Partition> 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());
Expand Down

0 comments on commit b4671b0

Please sign in to comment.