This is an automated email from the ASF dual-hosted git repository.

w41ter pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 3b1bb2e4453 [fix](fe) Fix the default value of 
ReplacePartitionClause.isStrictRange (#38688) (#38881)
3b1bb2e4453 is described below

commit 3b1bb2e44535e531d83e9f6b452ff2f2a598339a
Author: walter <w41te...@gmail.com>
AuthorDate: Mon Aug 5 20:59:40 2024 +0800

    [fix](fe) Fix the default value of ReplacePartitionClause.isStrictRange 
(#38688) (#38881)
---
 .../apache/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 6d7f88c089b..d19e14be080 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<String> getPartitionNames() {
@@ -121,4 +130,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;
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to