This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 307ee96eae5 [enhancement](delete) Add a hint msg for forbidden delete 
when MV or rollup exists (#39505)
307ee96eae5 is described below

commit 307ee96eae5839a64e0275d5919f4fb2e1c0b3d3
Author: Siyang Tang <82279870+tangsiyang2...@users.noreply.github.com>
AuthorDate: Sun Aug 18 13:53:24 2024 +0800

    [enhancement](delete) Add a hint msg for forbidden delete when MV or rollup 
exists (#39505)
    
    ## 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 e610f4b3ce3..ab2b646ce39 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
@@ -446,4 +446,8 @@ public class Partition extends MetaObject {
             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 4ccbfa44d8c..6081fc2878b 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
@@ -316,13 +316,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

Reply via email to