From 2dd668a63dcd8d05e5108cdf85b693a2f463c302 Mon Sep 17 00:00:00 2001 From: bobhan1 Date: Fri, 11 Aug 2023 14:35:17 +0800 Subject: [PATCH] update --- .../doris/planner/StreamLoadPlanner.java | 6 +- .../partial_update/delete_sign.csv | 3 + .../test_partial_update_delete_sign.out | 22 +++++++ .../test_partial_update_delete_sign.groovy | 60 +++++++++++++++++++ 4 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 regression-test/data/unique_with_mow_p0/partial_update/delete_sign.csv create mode 100644 regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.out create mode 100644 regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.groovy diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java index ccdd7b336e1ff7..07d54037d2b39a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java @@ -153,9 +153,9 @@ public TExecPlanFragmentParams plan(TUniqueId loadId, int fragmentInstanceIdInde for (ImportColumnDesc importColumnDesc : taskInfo.getColumnExprDescs().descs) { if (importColumnDesc.getColumnName() != null && importColumnDesc.getColumnName().equals(col.getName())) { - if (!col.isVisible()) { - throw new UserException("Partial update should not include invisible column: " - + col.getName()); + if (!col.isVisible() && !Column.DELETE_SIGN.equals(col.getName())) { + throw new UserException("Partial update should not include invisible column except" + + " delete sign column: " + col.getName()); } partialUpdateInputColumns.add(col.getName()); if (destTable.hasSequenceCol() && (taskInfo.hasSequenceCol() || ( diff --git a/regression-test/data/unique_with_mow_p0/partial_update/delete_sign.csv b/regression-test/data/unique_with_mow_p0/partial_update/delete_sign.csv new file mode 100644 index 00000000000000..712d86b9aba353 --- /dev/null +++ b/regression-test/data/unique_with_mow_p0/partial_update/delete_sign.csv @@ -0,0 +1,3 @@ +1,1 +3,1 +5,1 \ No newline at end of file diff --git a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.out b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.out new file mode 100644 index 00000000000000..f66f4b6873a507 --- /dev/null +++ b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.out @@ -0,0 +1,22 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql -- +1 1 1 1 1 +2 2 2 2 2 +3 3 3 3 3 +4 4 4 4 4 +5 5 5 5 5 + +-- !after_delete -- +2 2 2 2 2 +4 4 4 4 4 + +-- !with_delete_sign -- +1 \N \N \N \N 1 +1 1 1 1 1 0 +2 2 2 2 2 0 +3 \N \N \N \N 1 +3 3 3 3 3 0 +4 4 4 4 4 0 +5 \N \N \N \N 1 +5 5 5 5 5 0 + diff --git a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.groovy b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.groovy new file mode 100644 index 00000000000000..1aa651c48c91ff --- /dev/null +++ b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_delete_sign.groovy @@ -0,0 +1,60 @@ +// 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('test_partial_update_delete_sign') { + sql 'set enable_nereids_planner=false' + sql "set experimental_enable_nereids_planner=false;" + sql 'set enable_nereids_dml=false' + + def tableName1 = "test_partial_update_delete_sign1" + sql "DROP TABLE IF EXISTS ${tableName1};" + sql """ CREATE TABLE IF NOT EXISTS ${tableName1} ( + `k1` int NOT NULL, + `c1` int, + `c2` int, + `c3` int, + `c4` int + )UNIQUE KEY(k1) + DISTRIBUTED BY HASH(k1) BUCKETS 1 + PROPERTIES ( + "enable_unique_key_merge_on_write" = "true", + "disable_auto_compaction" = "true", + "replication_num" = "1" + );""" + + sql "insert into ${tableName1} values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5);" + qt_sql "select * from ${tableName1} order by k1,c1,c2,c3,c4;" + streamLoad { + table "${tableName1}" + + set 'column_separator', ',' + set 'format', 'csv' + set 'partial_columns', 'true' + set 'columns', 'k1,__DORIS_DELETE_SIGN__' + + file 'delete_sign.csv' + time 10000 // limit inflight 10s + } + sql "sync" + qt_after_delete "select * from ${tableName1} order by k1,c1,c2,c3,c4;" + sql "set skip_delete_sign=true;" + sql "set skip_storage_engine_merge=true;" + sql "set skip_delete_bitmap=true;" + sql "sync" + qt_with_delete_sign "select k1,c1,c2,c3,c4,__DORIS_DELETE_SIGN__ from ${tableName1} order by k1,c1,c2,c3,c4,__DORIS_DELETE_SIGN__;" + sql "drop table if exists ${tableName1};" +}