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

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

commit 9db389851b6e326735a5406f7c62e5d0a51f2d07
Author: morrySnow <zhangwen...@selectdb.com>
AuthorDate: Thu Feb 13 11:49:32 2025 +0800

    branch-3.0: [fix](Nereids) normalize plan should also lock target table 
#47843
    
    pick from master #47843
---
 .../nereids/trees/plans/commands/insert/InsertUtils.java     | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java
index 459ffcd04f8..e6418e062be 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java
@@ -260,7 +260,17 @@ public class InsertUtils {
     /**
      * normalize plan to let it could be process correctly by nereids
      */
-    public static Plan normalizePlan(Plan plan, TableIf table, 
Optional<InsertCommandContext> insertCtx) {
+    public static Plan normalizePlan(LogicalPlan plan, TableIf table, 
Optional<InsertCommandContext> insertCtx) {
+        table.readLock();
+        try {
+            return normalizePlanWithoutLock(plan, table, insertCtx);
+        } finally {
+            table.readUnlock();
+        }
+    }
+
+    private static Plan normalizePlanWithoutLock(LogicalPlan plan, TableIf 
table,
+            Optional<InsertCommandContext> insertCtx) {
         UnboundLogicalSink<? extends Plan> unboundLogicalSink = 
(UnboundLogicalSink<? extends Plan>) plan;
         if (table instanceof HMSExternalTable) {
             HMSExternalTable hiveTable = (HMSExternalTable) table;


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

Reply via email to