forked from apache/doris
-
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.
- Loading branch information
1 parent
73f632a
commit 6f8bfc2
Showing
7 changed files
with
245 additions
and
3 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
19 changes: 19 additions & 0 deletions
19
regression-test/data/nereids_p0/insert_into_table/partial_update_seq_col.out
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,19 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select_default -- | ||
1 doris 1000 123 1 2023-01-01 | ||
2 doris2 2000 223 1 2023-01-01 | ||
|
||
-- !partial_update_without_seq -- | ||
1 doris 200 123 1 2023-01-01 | ||
2 doris2 400 223 1 2023-01-01 | ||
|
||
-- !partial_update_with_seq -- | ||
1 doris 200 123 1 2023-01-01 | ||
2 doris2 2600 223 1 2023-07-20 | ||
3 unknown 2500 \N 4321 2022-07-18 | ||
|
||
-- !partial_update_with_seq_hidden_columns -- | ||
1 doris 200 123 1 2023-01-01 0 3 2023-01-01 | ||
2 doris2 2600 223 1 2023-07-20 0 4 2023-07-20 | ||
3 unknown 2500 \N 4321 2022-07-18 0 4 2022-07-18 | ||
|
19 changes: 19 additions & 0 deletions
19
...ession-test/data/unique_with_mow_p0/partial_update/test_partial_update_insert_seq_col.out
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,19 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select_default -- | ||
1 doris 1000 123 1 2023-01-01 | ||
2 doris2 2000 223 1 2023-01-01 | ||
|
||
-- !partial_update_without_seq -- | ||
1 doris 200 123 1 2023-01-01 | ||
2 doris2 400 223 1 2023-01-01 | ||
|
||
-- !partial_update_with_seq -- | ||
1 doris 200 123 1 2023-01-01 | ||
2 doris2 2600 223 1 2023-07-20 | ||
3 unknown 2500 \N 4321 2022-07-18 | ||
|
||
-- !partial_update_with_seq_hidden_columns -- | ||
1 doris 200 123 1 2023-01-01 0 3 2023-01-01 | ||
2 doris2 2600 223 1 2023-07-20 0 4 2023-07-20 | ||
3 unknown 2500 \N 4321 2022-07-18 0 4 2022-07-18 | ||
|
89 changes: 89 additions & 0 deletions
89
regression-test/suites/nereids_p0/insert_into_table/partial_update_seq_col.groovy
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,89 @@ | ||
|
||
// 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("nereids_partial_update_native_insert_seq_col", "p0") { | ||
sql "set enable_nereids_dml=true;" | ||
sql "set experimental_enable_nereids_planner=true;" | ||
sql "set enable_fallback_to_original_planner=false;" | ||
sql "sync;" | ||
|
||
def tableName = "nereids_partial_update_native_insert_seq_col" | ||
sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
sql """ | ||
CREATE TABLE ${tableName} ( | ||
`id` int(11) NOT NULL COMMENT "用户 ID", | ||
`name` varchar(65533) DEFAULT "unknown" COMMENT "用户姓名", | ||
`score` int(11) NOT NULL COMMENT "用户得分", | ||
`test` int(11) NULL COMMENT "null test", | ||
`dft` int(11) DEFAULT "4321", | ||
`update_time` date NULL) | ||
UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 1 | ||
PROPERTIES( | ||
"replication_num" = "1", | ||
"enable_unique_key_merge_on_write" = "true", | ||
"function_column.sequence_col" = "update_time" | ||
) | ||
""" | ||
sql """ insert into ${tableName} values | ||
(2, "doris2", 2000, 223, 1, '2023-01-01'), | ||
(1, "doris", 1000, 123, 1, '2023-01-01');""" | ||
sql "sync" | ||
|
||
qt_select_default """ select * from ${tableName} order by id;""" | ||
|
||
// don't set partial update header, it's a row update streamload | ||
// the input data don't contains sequence mapping column, will load fail | ||
test { | ||
sql "insert into ${tableName}(id,score) values(2,400),(1,200);" | ||
exception "Table nereids_partial_update_native_insert_seq_col has sequence column, need to specify the sequence column" | ||
} | ||
|
||
// set partial update header, should success | ||
// we don't provide the sequence column in input data, so the updated rows | ||
// should use there original sequence column values. | ||
sql "set enable_unique_key_partial_update=true;" | ||
sql "sync;" | ||
sql "insert into ${tableName}(id,score) values(2,400),(1,200);" | ||
sql "set enable_unique_key_partial_update=false;" | ||
sql "sync;" | ||
|
||
qt_partial_update_without_seq """ select * from ${tableName} order by id;""" | ||
|
||
// provide the sequence column this time, should update according to the | ||
// given sequence values | ||
sql "set enable_unique_key_partial_update=true;" | ||
sql "set enable_insert_strict = false;" | ||
sql "sync;" | ||
sql """insert into ${tableName}(id,score,update_time) values | ||
(2,2500,"2023-07-19"), | ||
(2,2600,"2023-07-20"), | ||
(1,1300,"2022-07-19"), | ||
(3,1500,"2022-07-20"), | ||
(3,2500,"2022-07-18");""" | ||
sql "set enable_unique_key_partial_update=false;" | ||
sql "sync;" | ||
|
||
qt_partial_update_with_seq """ select * from ${tableName} order by id;""" | ||
|
||
sql "SET show_hidden_columns=true" | ||
sql "sync" | ||
|
||
qt_partial_update_with_seq_hidden_columns """select * from ${tableName} order by id;""" | ||
|
||
sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
} |
89 changes: 89 additions & 0 deletions
89
...n-test/suites/unique_with_mow_p0/partial_update/test_partial_update_insert_seq_col.groovy
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,89 @@ | ||
|
||
// 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_native_insert_seq_col_old_planner", "p0") { | ||
sql "set enable_nereids_dml=false;" | ||
sql "set experimental_enable_nereids_planner=false;" | ||
sql "set enable_fallback_to_original_planner=true;" | ||
sql "sync;" | ||
|
||
def tableName = "test_partial_update_native_insert_seq_col_old_planner" | ||
sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
sql """ | ||
CREATE TABLE ${tableName} ( | ||
`id` int(11) NOT NULL COMMENT "用户 ID", | ||
`name` varchar(65533) DEFAULT "unknown" COMMENT "用户姓名", | ||
`score` int(11) NOT NULL COMMENT "用户得分", | ||
`test` int(11) NULL COMMENT "null test", | ||
`dft` int(11) DEFAULT "4321", | ||
`update_time` date NULL) | ||
UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 1 | ||
PROPERTIES( | ||
"replication_num" = "1", | ||
"enable_unique_key_merge_on_write" = "true", | ||
"function_column.sequence_col" = "update_time" | ||
) | ||
""" | ||
sql """ insert into ${tableName} values | ||
(2, "doris2", 2000, 223, 1, '2023-01-01'), | ||
(1, "doris", 1000, 123, 1, '2023-01-01');""" | ||
sql "sync" | ||
|
||
qt_select_default """ select * from ${tableName} order by id;""" | ||
|
||
// don't set partial update header, it's a row update streamload | ||
// the input data don't contains sequence mapping column, will load fail | ||
test { | ||
sql "insert into ${tableName}(id,score) values(2,400),(1,200);" | ||
exception "Table test_partial_update_native_insert_seq_col_old_planner has sequence column, need to specify the sequence column" | ||
} | ||
|
||
// set partial update header, should success | ||
// we don't provide the sequence column in input data, so the updated rows | ||
// should use there original sequence column values. | ||
sql "set enable_unique_key_partial_update=true;" | ||
sql "sync;" | ||
sql "insert into ${tableName}(id,score) values(2,400),(1,200);" | ||
sql "set enable_unique_key_partial_update=false;" | ||
sql "sync;" | ||
|
||
qt_partial_update_without_seq """ select * from ${tableName} order by id;""" | ||
|
||
// provide the sequence column this time, should update according to the | ||
// given sequence values | ||
sql "set enable_unique_key_partial_update=true;" | ||
sql "set enable_insert_strict = false;" | ||
sql "sync;" | ||
sql """insert into ${tableName}(id,score,update_time) values | ||
(2,2500,"2023-07-19"), | ||
(2,2600,"2023-07-20"), | ||
(1,1300,"2022-07-19"), | ||
(3,1500,"2022-07-20"), | ||
(3,2500,"2022-07-18");""" | ||
sql "set enable_unique_key_partial_update=false;" | ||
sql "sync;" | ||
|
||
qt_partial_update_with_seq """ select * from ${tableName} order by id;""" | ||
|
||
sql "SET show_hidden_columns=true" | ||
sql "sync" | ||
|
||
qt_partial_update_with_seq_hidden_columns """select * from ${tableName} order by id;""" | ||
|
||
sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
} |