From c7427ddda0511131fc14c8e1382056d95b47cf83 Mon Sep 17 00:00:00 2001 From: walter Date: Sun, 4 Aug 2024 10:38:31 +0800 Subject: [PATCH] [fix](fe) Fix the default value of ReplacePartitionClause.isStrictRange (#38688) 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 9a827c82f81a9c..39b96f9eb06303 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() { @@ -131,4 +140,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; + } }