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 72445f727ef branch-3.0: [enhance](mtmv)insert overwrite of mtmv force 
drop partition #48074 (#48627)
72445f727ef is described below

commit 72445f727ef782b9ed213744842388584011a2fd
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Mar 10 20:52:33 2025 +0800

    branch-3.0: [enhance](mtmv)insert overwrite of mtmv force drop partition 
#48074 (#48627)
    
    Cherry-picked from #48074
    
    Co-authored-by: zhangdong <zhangd...@selectdb.com>
---
 .../java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java | 7 ++++++-
 .../nereids/trees/plans/commands/UpdateMvByPartitionCommand.java   | 7 +++++++
 .../trees/plans/commands/insert/InsertOverwriteTableCommand.java   | 7 ++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
 
b/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
index c2842569ca5..49e3e091d57 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
@@ -69,6 +69,11 @@ public class InsertOverwriteUtil {
      */
     public static void replacePartition(TableIf olapTable, List<String> 
partitionNames,
             List<String> tempPartitionNames) throws DdlException {
+        replacePartition(olapTable, partitionNames, tempPartitionNames, false);
+    }
+
+    public static void replacePartition(TableIf olapTable, List<String> 
partitionNames,
+            List<String> tempPartitionNames, boolean isForce) throws 
DdlException {
         if (olapTable instanceof OlapTable) {
             try {
                 if (!olapTable.writeLockIfExist()) {
@@ -78,7 +83,7 @@ public class InsertOverwriteUtil {
                 
properties.put(PropertyAnalyzer.PROPERTIES_USE_TEMP_PARTITION_NAME, "false");
                 ReplacePartitionClause replacePartitionClause = new 
ReplacePartitionClause(
                         new PartitionNames(false, partitionNames),
-                        new PartitionNames(true, tempPartitionNames), false, 
properties);
+                        new PartitionNames(true, tempPartitionNames), isForce, 
properties);
                 if (replacePartitionClause.getTempPartitionNames().isEmpty()) {
                     return;
                 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateMvByPartitionCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateMvByPartitionCommand.java
index b0a95ffdd3a..d35eafffa2c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateMvByPartitionCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateMvByPartitionCommand.java
@@ -89,6 +89,13 @@ public class UpdateMvByPartitionCommand extends 
InsertOverwriteTableCommand {
         super(logicalQuery, Optional.empty(), Optional.empty());
     }
 
+    @Override
+    public boolean isForceDropPartition() {
+        // After refreshing the data in MTMV, it will be synchronized with the 
base table
+        // and there is no need to put it in the recycle bin
+        return true;
+    }
+
     /**
      * Construct command
      *
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertOverwriteTableCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertOverwriteTableCommand.java
index c89a4fc7be9..c4db84f378b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertOverwriteTableCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertOverwriteTableCommand.java
@@ -210,7 +210,8 @@ public class InsertOverwriteTableCommand extends Command 
implements ForwardWithS
                     insertOverwriteManager.taskFail(taskId);
                     return;
                 }
-                InsertOverwriteUtil.replacePartition(targetTable, 
partitionNames, tempPartitionNames);
+                InsertOverwriteUtil.replacePartition(targetTable, 
partitionNames, tempPartitionNames,
+                        isForceDropPartition());
                 if (isCancelled.get()) {
                     LOG.info("insert overwrite is cancelled before 
taskSuccess, do nothing, queryId: {}",
                             ctx.getQueryIdentifier());
@@ -365,6 +366,10 @@ public class InsertOverwriteTableCommand extends Command 
implements ForwardWithS
         return InsertUtils.getPlanForExplain(ctx, this.logicalQuery);
     }
 
+    public boolean isForceDropPartition() {
+        return false;
+    }
+
     @Override
     public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
         return visitor.visitInsertOverwriteTableCommand(this, context);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to