From 6cd0f80ec0b82c62eda4242968d060cb3cc8ed41 Mon Sep 17 00:00:00 2001 From: w41ter Date: Thu, 1 Aug 2024 07:01:56 +0000 Subject: [PATCH] [fix](fe) Fix the default value of ReplacePartitionClause.isStrictRange 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). This PR handle the relevant properties when constructing ReplacePartitionClause. --- .../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 4d059b23d245e7..4991ba6575abd7 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 @@ -66,6 +66,15 @@ public ReplacePartitionClause(PartitionNames partitionNames, PartitionNames temp this.needTableStable = false; this.forceDropOldPartition = isForce; 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() { @@ -141,4 +150,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; + } }