[enhance](mtmv)When obtaining the partition list fails, treat the pai… (#46708)
…mon table as an unpartitioned table (#46641) pick: https://github.com/apache/doris/pull/46641
This commit is contained in:
@ -144,9 +144,17 @@ public class PaimonExternalTable extends ExternalTable implements MvccTable {
|
||||
|
||||
@Override
|
||||
public List<Column> getPartitionColumns(Optional<MvccSnapshot> snapshot) {
|
||||
if (isPartitionInvalid(snapshot)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getPaimonSchemaCacheValue(snapshot).getPartitionColumns();
|
||||
}
|
||||
|
||||
private boolean isPartitionInvalid(Optional<MvccSnapshot> snapshot) {
|
||||
PaimonSnapshotCacheValue paimonSnapshotCacheValue = getOrFetchSnapshotCacheValue(snapshot);
|
||||
return paimonSnapshotCacheValue.getPartitionInfo().isPartitionInvalid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MvccSnapshot loadSnapshot() {
|
||||
return new PaimonMvccSnapshot(getPaimonSnapshotCacheValue());
|
||||
|
||||
@ -45,4 +45,9 @@ public class PaimonPartitionInfo {
|
||||
public Map<String, PaimonPartition> getNameToPartition() {
|
||||
return nameToPartition;
|
||||
}
|
||||
|
||||
public boolean isPartitionInvalid() {
|
||||
// when transfer to partitionItem failed, will not equal
|
||||
return nameToPartitionItem.size() != nameToPartition.size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ public class PaimonUtil {
|
||||
}
|
||||
|
||||
public static PaimonPartitionInfo generatePartitionInfo(List<Column> partitionColumns,
|
||||
List<PaimonPartition> paimonPartitions) throws AnalysisException {
|
||||
List<PaimonPartition> paimonPartitions) {
|
||||
Map<String, PartitionItem> nameToPartitionItem = Maps.newHashMap();
|
||||
Map<String, PaimonPartition> nameToPartition = Maps.newHashMap();
|
||||
PaimonPartitionInfo partitionInfo = new PaimonPartitionInfo(nameToPartitionItem, nameToPartition);
|
||||
@ -127,7 +127,14 @@ public class PaimonUtil {
|
||||
for (PaimonPartition paimonPartition : paimonPartitions) {
|
||||
String partitionName = getPartitionName(partitionColumns, paimonPartition.getPartitionValues());
|
||||
nameToPartition.put(partitionName, paimonPartition);
|
||||
nameToPartitionItem.put(partitionName, toListPartitionItem(partitionName, partitionColumns));
|
||||
try {
|
||||
// partition values return by paimon api, may have problem,
|
||||
// to avoid affecting the query, we catch exceptions here
|
||||
nameToPartitionItem.put(partitionName, toListPartitionItem(partitionName, partitionColumns));
|
||||
} catch (Exception e) {
|
||||
LOG.warn("toListPartitionItem failed, partitionColumns: {}, partitionValues: {}", partitionColumns,
|
||||
paimonPartition.getPartitionValues(), e);
|
||||
}
|
||||
}
|
||||
return partitionInfo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user