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

huajianlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new b10910b9d10 [Fix]fix insert overwrite non-partition table null pointer 
exception (#33205)
b10910b9d10 is described below

commit b10910b9d107ada4c41bcad2a62d3801b2e19ad4
Author: feiniaofeiafei <53502832+feiniaofeia...@users.noreply.github.com>
AuthorDate: Mon Apr 8 19:26:21 2024 +0800

    [Fix]fix insert overwrite non-partition table null pointer exception 
(#33205)
    
    fix legacy planner bug when insert overwrite non-partition table.
---
 .../java/org/apache/doris/qe/StmtExecutor.java     |  8 +++---
 .../insert_overwrite_legacy_unpartitioned.groovy   | 31 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 33aa57cca3c..ac5e3221355 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -2805,12 +2805,12 @@ public class StmtExecutor {
         ConnectContext.get().setSkipAuth(true);
         try {
             InsertOverwriteTableStmt iotStmt = (InsertOverwriteTableStmt) 
this.parsedStmt;
-            if (iotStmt.isAutoDetectPartition()) {
-                // insert overwrite table auto detect which partitions need to 
replace
-                handleAutoOverwritePartition(iotStmt);
-            } else if (iotStmt.getPartitionNames().size() == 0) {
+            if (iotStmt.getPartitionNames().size() == 0) {
                 // insert overwrite table
                 handleOverwriteTable(iotStmt);
+            } else if (iotStmt.isAutoDetectPartition()) {
+                // insert overwrite table auto detect which partitions need to 
replace
+                handleAutoOverwritePartition(iotStmt);
             } else {
                 // insert overwrite table with partition
                 handleOverwritePartition(iotStmt);
diff --git 
a/regression-test/suites/insert_overwrite_p0/insert_overwrite_legacy_unpartitioned.groovy
 
b/regression-test/suites/insert_overwrite_p0/insert_overwrite_legacy_unpartitioned.groovy
new file mode 100644
index 00000000000..4b779f5beb4
--- /dev/null
+++ 
b/regression-test/suites/insert_overwrite_p0/insert_overwrite_legacy_unpartitioned.groovy
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("insert_overwrite_legacy_unpartitioned") {
+    sql "drop table if exists test_no_partition_insert"
+    sql """
+        create table test_no_partition_insert (a int, b int)
+        duplicate key(a)
+        distributed by hash(a) buckets 32
+        properties(
+            "replication_allocation"="tag.location.default: 1"
+        );
+    """
+
+    sql """insert overwrite table test_no_partition_insert
+        select 1,2 from test_no_partition_insert minus select 1,2 from 
test_no_partition_insert;"""
+}
\ No newline at end of file


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

Reply via email to