[enhancement](delete) Add a hint msg for forbidden delete when MV or 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.
This commit is contained in:
@ -474,4 +474,8 @@ public class Partition extends MetaObject implements Writable {
|
||||
distributionInfo = ((HashDistributionInfo) distributionInfo).toRandomDistributionInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRollupIndex(long id) {
|
||||
return idToVisibleRollupIndex.containsKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,13 +313,17 @@ public class DeleteJob extends AbstractTxnStateChangeCallback implements DeleteJ
|
||||
() -> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user