From 9c020f9db1226bbc3b0e770ab6aa7fc370dccd1b Mon Sep 17 00:00:00 2001 From: walter Date: Mon, 5 Aug 2024 20:59:50 +0800 Subject: [PATCH] [fix](fe) Fix the default value of ReplacePartitionClause.isStrictRange (#38688) (#38879) --- .../doris/analysis/ReplacePartitionClause.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ReplacePartitionClause.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ReplacePartitionClause.java index 9a827c82f8..39b96f9eb0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ReplacePartitionClause.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ReplacePartitionClause.java @@ -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 getPartitionNames() { @@ -131,4 +140,12 @@ public class ReplacePartitionClause extends AlterTableClause { public String toString() { return toSql(); } + + public static boolean getBoolProperty(Map properties, String propKey, boolean defaultVal) { + if (properties != null && properties.containsKey(propKey)) { + String val = properties.get(propKey); + return Boolean.parseBoolean(val); + } + return defaultVal; + } }