[fix](fe) Fix the default value of ReplacePartitionClause.isStrictRange (#38688) (#38879)

This commit is contained in:
walter
2024-08-05 20:59:50 +08:00
committed by GitHub
parent ce75e6adfe
commit 9c020f9db1

View File

@ -61,6 +61,15 @@ public class ReplacePartitionClause extends AlterTableClause {
this.tempPartitionNames = tempPartitionNames;
this.needTableStable = false;
this.properties = properties;
// ATTN: During ReplacePartitionClause.analyze(), the default value of isStrictRange is true.
// However, ReplacePartitionClause instances constructed by internal code do not call analyze(),
// so their isStrictRange value is incorrect (e.g., INSERT INTO ... OVERWRITE).
//
// Considering this, we should handle the relevant properties when constructing.
this.isStrictRange = getBoolProperty(properties, PropertyAnalyzer.PROPERTIES_STRICT_RANGE, true);
this.useTempPartitionName = getBoolProperty(
properties, PropertyAnalyzer.PROPERTIES_USE_TEMP_PARTITION_NAME, false);
}
public List<String> getPartitionNames() {
@ -131,4 +140,12 @@ public class ReplacePartitionClause extends AlterTableClause {
public String toString() {
return toSql();
}
public static boolean getBoolProperty(Map<String, String> properties, String propKey, boolean defaultVal) {
if (properties != null && properties.containsKey(propKey)) {
String val = properties.get(propKey);
return Boolean.parseBoolean(val);
}
return defaultVal;
}
}