This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new d06c13f5b8c [fix](partial update) Fix NPE when the query statement of
an update statement is a point query in OriginPlanner #26881 (#26900)
d06c13f5b8c is described below
commit d06c13f5b8c1e0a7ca632356c7e550a6023180e9
Author: bobhan1 <[email protected]>
AuthorDate: Tue Nov 14 16:10:38 2023 +0800
[fix](partial update) Fix NPE when the query statement of an update
statement is a point query in OriginPlanner #26881 (#26900)
---
.../org/apache/doris/planner/OriginalPlanner.java | 2 +-
regression-test/data/update/test_update_mow.out | 15 +++++++++++
.../suites/update/test_update_mow.groovy | 31 ++++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/OriginalPlanner.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/OriginalPlanner.java
index f77aba25dac..ac16bbaf658 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OriginalPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OriginalPlanner.java
@@ -204,7 +204,7 @@ public class OriginalPlanner extends Planner {
}
checkAndSetTopnOpt(singleNodePlan);
- if (queryOptions.num_nodes == 1 || queryStmt.isPointQuery()) {
+ if ((queryOptions.num_nodes == 1 || queryStmt.isPointQuery()) &&
!(statement instanceof InsertStmt)) {
// single-node execution; we're almost done
singleNodePlan = addUnassignedConjuncts(analyzer, singleNodePlan);
fragments.add(new PlanFragment(plannerContext.getNextFragmentId(),
singleNodePlan,
diff --git a/regression-test/data/update/test_update_mow.out
b/regression-test/data/update/test_update_mow.out
index 615ee7b07dd..ed072a5c0a2 100644
--- a/regression-test/data/update/test_update_mow.out
+++ b/regression-test/data/update/test_update_mow.out
@@ -23,3 +23,18 @@ date_value DATE Yes false \N NONE
2 20 2 2000.0 2000-01-02
3 3 3 3.0 2000-01-03
+-- !sql --
+a 1 2023-11-12T00:00 test1 1
+b 2 2023-11-12T00:00 test2 2
+c 3 2023-11-12T00:00 test3 3
+
+-- !sql --
+a 1 2023-11-12T00:00 test1 999
+b 2 2023-11-12T00:00 test2 2
+c 3 2023-11-12T00:00 test3 3
+
+-- !sql --
+a 1 2023-11-12T00:00 test1 999
+b 2 2023-11-12T00:00 test2 2
+c 3 2022-01-01T00:00 update value 3
+
diff --git a/regression-test/suites/update/test_update_mow.groovy
b/regression-test/suites/update/test_update_mow.groovy
index df0d1a4e57a..27a663484f6 100644
--- a/regression-test/suites/update/test_update_mow.groovy
+++ b/regression-test/suites/update/test_update_mow.groovy
@@ -96,4 +96,35 @@ suite("test_update_mow", "p0") {
sql "DROP TABLE IF EXISTS ${tbName2}"
sql "DROP TABLE IF EXISTS ${tbName3}"
sql "DROP TABLE IF EXISTS ${tbName4}"
+
+
+ sql "set experimental_enable_nereids_planner=false;"
+ sql "set enable_nereids_planner=false"
+ sql "sync"
+ def tableName5 = "test_update_mow_5"
+ sql "DROP TABLE IF EXISTS ${tableName5}"
+ sql """ CREATE TABLE ${tableName5} (
+ k1 varchar(100) NOT NULL,
+ k2 int(11) NOT NULL,
+ v1 datetime NULL,
+ v2 varchar(100) NULL,
+ v3 int NULL) ENGINE=OLAP UNIQUE KEY(k1, k2) COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(k1, k2) BUCKETS 3
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "enable_unique_key_merge_on_write" = "true",
+ "light_schema_change" = "true",
+ "store_row_column" = "true",
+ "enable_single_replica_compaction" = "false");"""
+ sql """insert into ${tableName5} values
+ ("a",1,"2023-11-12 00:00:00","test1",1),
+ ("b",2,"2023-11-12 00:00:00","test2",2),
+ ("c",3,"2023-11-12 00:00:00","test3",3);"""
+ qt_sql "select * from ${tableName5} order by k1,k2"
+ sql """update ${tableName5} set v3=999 where k1="a" and k2=1;"""
+ qt_sql "select * from ${tableName5} order by k1,k2"
+ sql """update ${tableName5} set v2="update value", v1="2022-01-01
00:00:00" where k1="c" and k2=3;"""
+ qt_sql "select * from ${tableName5} order by k1,k2"
+
+ sql "DROP TABLE IF EXISTS ${tableName5}"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]