Skip to content

Commit

Permalink
[Fix](delete) Fix error when creating a non-MOW table while the defau…
Browse files Browse the repository at this point in the history
…lt value of `enable_mow_light_delete` is true (apache#40197)

## Proposed changes

Fix the issue where an error occurs when creating a non-MOW table while
the default value of `enable_mow_light_delete` is set to true.

<!--Describe your changes.-->
  • Loading branch information
Yukang-Lian committed Sep 2, 2024
1 parent cc5430e commit 16d120c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1183,14 +1183,15 @@ public static boolean analyzeUniqueKeyMergeOnWrite(Map<String, String> propertie
throw new AnalysisException(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE + " must be `true` or `false`");
}

public static boolean analyzeEnableDeleteOnDeletePredicate(Map<String, String> properties)
public static boolean analyzeEnableDeleteOnDeletePredicate(Map<String, String> properties,
boolean enableUniqueKeyMergeOnWrite)
throws AnalysisException {
if (properties == null || properties.isEmpty()) {
return Config.enable_mow_light_delete;
return enableUniqueKeyMergeOnWrite ? Config.enable_mow_light_delete : false;
}
String value = properties.get(PropertyAnalyzer.PROPERTIES_ENABLE_MOW_LIGHT_DELETE);
if (value == null) {
return Config.enable_mow_light_delete;
return enableUniqueKeyMergeOnWrite ? Config.enable_mow_light_delete : false;
}
properties.remove(PropertyAnalyzer.PROPERTIES_ENABLE_MOW_LIGHT_DELETE);
if (value.equals("true")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,8 @@ private boolean createOlapTable(Database db, CreateTableStmt stmt) throws UserEx

boolean enableDeleteOnDeletePredicate = false;
try {
enableDeleteOnDeletePredicate = PropertyAnalyzer.analyzeEnableDeleteOnDeletePredicate(properties);
enableDeleteOnDeletePredicate = PropertyAnalyzer.analyzeEnableDeleteOnDeletePredicate(properties,
enableUniqueKeyMergeOnWrite);
} catch (AnalysisException e) {
throw new DdlException(e.getMessage());
}
Expand Down

0 comments on commit 16d120c

Please sign in to comment.