From 3b1bb2e44535e531d83e9f6b452ff2f2a598339a Mon Sep 17 00:00:00 2001 From: walter Date: Mon, 5 Aug 2024 20:59:40 +0800 Subject: [PATCH] [fix](fe) Fix the default value of ReplacePartitionClause.isStrictRange (#38688) (#38881) --- .../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 6d7f88c089bce2..d19e14be0802b1 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 ReplacePartitionClause(PartitionNames partitionNames, PartitionNames temp 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() { @@ -121,4 +130,12 @@ public String toSql() { 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; + } }