[fix](dynamic) Fix error reporting when dynamic partition properties contain incorrect attributes (#25373)

This commit is contained in:
Zhiyu Hu
2023-11-19 09:51:57 +08:00
committed by GitHub
parent 329abc3452
commit b560d863c2
3 changed files with 463 additions and 8 deletions

View File

@ -2286,7 +2286,7 @@ public class InternalCatalog implements CatalogIf<Database> {
DataProperty dataProperty = null;
try {
dataProperty = PropertyAnalyzer.analyzeDataProperty(stmt.getProperties(),
new DataProperty(DataProperty.DEFAULT_STORAGE_MEDIUM));
new DataProperty(DataProperty.DEFAULT_STORAGE_MEDIUM));
} catch (AnalysisException e) {
throw new DdlException(e.getMessage());
}
@ -2297,7 +2297,6 @@ public class InternalCatalog implements CatalogIf<Database> {
partitionInfo.setTabletType(partitionId, tabletType);
partitionInfo.setIsMutable(partitionId, isMutable);
}
// check colocation properties
try {
String colocateGroup = PropertyAnalyzer.analyzeColocate(properties);
@ -2457,10 +2456,16 @@ public class InternalCatalog implements CatalogIf<Database> {
} else if (partitionInfo.getType() == PartitionType.RANGE
|| partitionInfo.getType() == PartitionType.LIST) {
try {
PropertyAnalyzer.analyzeDataProperty(stmt.getProperties(),
new DataProperty(DataProperty.DEFAULT_STORAGE_MEDIUM));
Map<String, String> propertiesCheck = new HashMap<>(properties);
propertiesCheck.entrySet().removeIf(entry -> entry.getKey().contains("dynamic_partition"));
if (propertiesCheck != null && !propertiesCheck.isEmpty()) {
// here, all properties should be checked
throw new DdlException("Unknown properties: " + propertiesCheck);
}
// just for remove entries in stmt.getProperties(),
// and then check if there still has unknown properties
PropertyAnalyzer.analyzeDataProperty(stmt.getProperties(),
new DataProperty(DataProperty.DEFAULT_STORAGE_MEDIUM));
if (partitionInfo.getType() == PartitionType.RANGE) {
DynamicPartitionUtil.checkAndSetDynamicPartitionProperty(olapTable, properties, db);
} else if (partitionInfo.getType() == PartitionType.LIST) {
@ -2470,10 +2475,6 @@ public class InternalCatalog implements CatalogIf<Database> {
}
}
if (storagePolicy.equals("") && properties != null && !properties.isEmpty()) {
// here, all properties should be checked
throw new DdlException("Unknown properties: " + properties);
}
} catch (AnalysisException e) {
throw new DdlException(e.getMessage());
}