forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enhancement] Enable partial update to be used with condition update (S…
…tarRocks#30242) Actually, we can do a partial update with a condition update, but we reject it. This pr enables it.
- Loading branch information
Showing
12 changed files
with
196 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
100,k2_100,111,100,100,v4_100,v5_100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
100,k2_100,100 | ||
200,k2_200,222 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
-- name: test_condition_update | ||
show backends; | ||
create database test_condition_update_2fdsiou12s; | ||
-- result: | ||
-- !result | ||
use test_condition_update_2fdsiou12s; | ||
-- result: | ||
-- !result | ||
CREATE table tab1 ( | ||
k1 INTEGER, | ||
k2 VARCHAR(50), | ||
v1 INTEGER, | ||
v2 INTEGER, | ||
v3 INTEGER, | ||
v4 varchar(50), | ||
v5 varchar(50) | ||
) | ||
ENGINE=OLAP | ||
PRIMARY KEY(`k1`,`k2`) | ||
DISTRIBUTED BY HASH(`k1`) BUCKETS 10 | ||
PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
-- result: | ||
-- !result | ||
insert into tab1 values (100, "k2_100", 100, 100, 100, "v4_100", "v5_100"); | ||
-- result: | ||
-- !result | ||
insert into tab1 values (200, "k2_200", 200, 200, 200, "v4_200", "v5_200"); | ||
-- result: | ||
-- !result | ||
insert into tab1 values (300, "k3_300", 300, 300, 300, "v4_300", "v5_300"); | ||
-- result: | ||
-- !result | ||
select * from tab1; | ||
-- result: | ||
100 k2_100 100 100 100 v4_100 v5_100 | ||
200 k2_200 200 200 200 v4_200 v5_200 | ||
300 k3_300 300 300 300 v4_300 v5_300 | ||
-- !result | ||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_1.csv -XPUT -H label:stream_load_condition_update_123432 -H column_separator:, -H merge_condition:k1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
-- result: | ||
0 | ||
{ | ||
"Status": "Fail", | ||
"Message": "Merge condition column k1 should not be primary key!" | ||
} | ||
-- !result | ||
sync; | ||
-- result: | ||
-- !result | ||
select * from tab1; | ||
-- result: | ||
300 k3_300 300 300 300 v4_300 v5_300 | ||
200 k2_200 200 200 200 v4_200 v5_200 | ||
100 k2_100 100 100 100 v4_100 v5_100 | ||
-- !result | ||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_1.csv -XPUT -H label:stream_load_condition_update_123433 -H column_separator:, -H merge_condition:v6 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
-- result: | ||
0 | ||
{ | ||
"Status": "Fail", | ||
"Message": "Merge condition column v6 does not exist. If you are doing partial update with condition update, please check condition column is in the given update columns. Otherwise please check condition column is in table tab1" | ||
} | ||
-- !result | ||
sync; | ||
-- result: | ||
-- !result | ||
select * from tab1; | ||
-- result: | ||
100 k2_100 100 100 100 v4_100 v5_100 | ||
200 k2_200 200 200 200 v4_200 v5_200 | ||
300 k3_300 300 300 300 v4_300 v5_300 | ||
-- !result | ||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_1.csv -XPUT -H label:stream_load_condition_update_123434 -H column_separator:, -H merge_condition:v1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
-- result: | ||
0 | ||
{ | ||
"Status": "Success", | ||
"Message": "OK" | ||
} | ||
-- !result | ||
sync; | ||
-- result: | ||
-- !result | ||
select * from tab1; | ||
-- result: | ||
100 k2_100 111 100 100 v4_100 v5_100 | ||
300 k3_300 300 300 300 v4_300 v5_300 | ||
200 k2_200 200 200 200 v4_200 v5_200 | ||
-- !result | ||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_2.csv -XPUT -H label:stream_load_condition_update_123435 -H column_separator:, -H merge_condition:v2 -H partial_update:true -H columns:k1,k2,v1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
-- result: | ||
0 | ||
{ | ||
"Status": "Fail", | ||
"Message": "Merge condition column v2 does not exist. If you are doing partial update with condition update, please check condition column is in the given update columns. Otherwise please check condition column is in table tab1" | ||
} | ||
-- !result | ||
sync; | ||
-- result: | ||
-- !result | ||
select * from tab1; | ||
-- result: | ||
300 k3_300 300 300 300 v4_300 v5_300 | ||
200 k2_200 200 200 200 v4_200 v5_200 | ||
100 k2_100 111 100 100 v4_100 v5_100 | ||
-- !result | ||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_2.csv -XPUT -H label:stream_load_condition_update_123436 -H column_separator:, -H merge_condition:v1 -H partial_update:true -H columns:k1,k2,v1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
-- result: | ||
0 | ||
{ | ||
"Status": "Success", | ||
"Message": "OK" | ||
} | ||
-- !result | ||
sync; | ||
-- result: | ||
-- !result | ||
select * from tab1; | ||
-- result: | ||
100 k2_100 111 100 100 v4_100 v5_100 | ||
300 k3_300 300 300 300 v4_300 v5_300 | ||
200 k2_200 222 200 200 v4_200 v5_200 | ||
-- !result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- name: test_condition_update | ||
show backends; | ||
create database test_condition_update_2fdsiou12s; | ||
use test_condition_update_2fdsiou12s; | ||
|
||
CREATE table tab1 ( | ||
k1 INTEGER, | ||
k2 VARCHAR(50), | ||
v1 INTEGER, | ||
v2 INTEGER, | ||
v3 INTEGER, | ||
v4 varchar(50), | ||
v5 varchar(50) | ||
) | ||
ENGINE=OLAP | ||
PRIMARY KEY(`k1`,`k2`) | ||
DISTRIBUTED BY HASH(`k1`) BUCKETS 10 | ||
PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
|
||
insert into tab1 values (100, "k2_100", 100, 100, 100, "v4_100", "v5_100"); | ||
insert into tab1 values (200, "k2_200", 200, 200, 200, "v4_200", "v5_200"); | ||
insert into tab1 values (300, "k3_300", 300, 300, 300, "v4_300", "v5_300"); | ||
select * from tab1; | ||
|
||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_1.csv -XPUT -H label:stream_load_condition_update_123432 -H column_separator:, -H merge_condition:k1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
sync; | ||
select * from tab1; | ||
|
||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_1.csv -XPUT -H label:stream_load_condition_update_123433 -H column_separator:, -H merge_condition:v6 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
sync; | ||
select * from tab1; | ||
|
||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_1.csv -XPUT -H label:stream_load_condition_update_123434 -H column_separator:, -H merge_condition:v1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
sync; | ||
select * from tab1; | ||
|
||
|
||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_2.csv -XPUT -H label:stream_load_condition_update_123435 -H column_separator:, -H merge_condition:v2 -H partial_update:true -H columns:k1,k2,v1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
sync; | ||
select * from tab1; | ||
|
||
|
||
shell: curl --location-trusted -u root: -T ${root_path}/lib/../common/data/stream_load/sr_condition_update_2.csv -XPUT -H label:stream_load_condition_update_123436 -H column_separator:, -H merge_condition:v1 -H partial_update:true -H columns:k1,k2,v1 ${url}/api/test_condition_update_2fdsiou12s/tab1/_stream_load | ||
sync; | ||
select * from tab1; | ||
|