[enhance](mtmv)mtmv support hive default partition (#32051)

This commit is contained in:
zhangdong
2024-03-12 18:59:39 +08:00
committed by yiguolei
parent 6acdd9cd48
commit 84af8e0a53
4 changed files with 127 additions and 5 deletions

View File

@ -20,6 +20,7 @@ package org.apache.doris.catalog;
import org.apache.doris.analysis.DateLiteral;
import org.apache.doris.analysis.Expr;
import org.apache.doris.analysis.MaxLiteral;
import org.apache.doris.analysis.NullLiteral;
import org.apache.doris.analysis.PartitionDesc;
import org.apache.doris.analysis.PartitionValue;
import org.apache.doris.analysis.SinglePartitionDesc;
@ -374,6 +375,8 @@ public class PartitionInfo implements Writable {
return PartitionValue.MAX_VALUE;
} else if (expr instanceof DateLiteral) {
return new PartitionValue(expr.getStringValue());
} else if (expr instanceof NullLiteral) {
return new PartitionValue("NULL", true);
} else {
return new PartitionValue(expr.getRealValue().toString());
}

View File

@ -105,7 +105,6 @@ public class HMSExternalTable extends ExternalTable implements MTMVRelatedTableI
private static final String USE_HIVE_SYNC_PARTITION = "use_hive_sync_partition";
static {
SUPPORTED_HIVE_FILE_FORMATS = Sets.newHashSet();
SUPPORTED_HIVE_FILE_FORMATS.add("org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat");
@ -778,10 +777,7 @@ public class HMSExternalTable extends ExternalTable implements MTMVRelatedTableI
.getMetaStoreCache((HMSExternalCatalog) getCatalog());
HiveMetaStoreCache.HivePartitionValues hivePartitionValues = cache.getPartitionValues(
getDbName(), getName(), getPartitionColumnTypes());
return hivePartitionValues.getIdToPartitionItem().entrySet().stream()
.filter(entry -> !entry.getValue().isDefaultPartition())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
return hivePartitionValues.getIdToPartitionItem();
}
@Override