Skip to content

Commit

Permalink
[fix](fe) Fix the default value of ReplacePartitionClause.isStrictRan…
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter authored Aug 5, 2024
1 parent 9129353 commit 3b1bb2e
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getPartitionNames() {
Expand Down Expand Up @@ -121,4 +130,12 @@ public String toSql() {
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;
}
}

0 comments on commit 3b1bb2e

Please sign in to comment.