This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 00e4f343b04 [enhancement](delete) Add a hint msg for forbidden delete when MV or rollup exists (#39505) (#39857) 00e4f343b04 is described below commit 00e4f343b043548fb0a182f5221d8306104aa49a Author: Siyang Tang <82279870+tangsiyang2...@users.noreply.github.com> AuthorDate: Fri Aug 23 23:42:26 2024 +0800 [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. --- fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java | 4 ++++ fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java index 2d0e8079cb1..a21ba68f0dd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java @@ -474,4 +474,8 @@ public class Partition extends MetaObject implements Writable { distributionInfo = ((HashDistributionInfo) distributionInfo).toRandomDistributionInfo(); } } + + public boolean isRollupIndex(long id) { + return idToVisibleRollupIndex.containsKey(id); + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java index 761db0f4725..dcdd91e7fc3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java @@ -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); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org