Skip to content

Commit

Permalink
[enhancement](delete) Add a hint msg for forbidden delete when MV or …
Browse files Browse the repository at this point in the history
…rollup exists (#39505) (#39857)

## Proposed changes

When MV or Rollup exists, delete is forbidden on the base table
currently. Add a hint msg to indicate it.
  • Loading branch information
TangSiyang2001 authored Aug 23, 2024
1 parent 9d597bd commit 00e4f34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,8 @@ public void convertHashDistributionToRandomDistribution() {
distributionInfo = ((HashDistributionInfo) distributionInfo).toRandomDistributionInfo();
}
}

public boolean isRollupIndex(long id) {
return idToVisibleRollupIndex.containsKey(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,17 @@ public void dispatch() throws Exception {
() -> Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER)));
for (Predicate condition : deleteConditions) {
SlotRef slotRef = (SlotRef) condition.getChild(0);
String columnName = new String(slotRef.getColumnName());
String columnName = slotRef.getColumnName();
TColumn column = colNameToColDesc.get(slotRef.getColumnName());
if (column == null) {
columnName = CreateMaterializedViewStmt.mvColumnBuilder(columnName);
column = colNameToColDesc.get(columnName);
}
if (column == null) {
if (partition.isRollupIndex(index.getId())) {
throw new AnalysisException("If MV or rollup index exists, do not support delete."
+ "Drop existing rollup or MV and try again.");
}
throw new AnalysisException(
"condition's column not founded in index, column=" + columnName + " , index=" + index);
}
Expand Down

0 comments on commit 00e4f34

Please sign in to comment.