-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improvement](delete) support delete predicate on value column for merge-on-write unique table #21933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[improvement](delete) support delete predicate on value column for merge-on-write unique table #21933
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d50c2dc
tmp
bobhan1 578abe0
delte on value
bobhan1 9814854
tmp
bobhan1 a0cdd4b
update
bobhan1 6d22b6f
upadte
bobhan1 bbc0480
fix
bobhan1 ce7e60d
fix ut
bobhan1 3d9ca5b
update
bobhan1 d51a4fd
fix
bobhan1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,94 @@ | ||
| -- This file is automatically generated. You should know what you did if you want to edit this | ||
| -- !sql -- | ||
| 1 1 1 | ||
| 2 2 2 | ||
| 3 3 3 | ||
| 4 4 4 | ||
| 5 5 5 | ||
| 6 6 6 | ||
| 7 7 7 | ||
| 8 8 8 | ||
| 9 9 9 | ||
|
|
||
| -- !sql -- | ||
| 1 1 1 | ||
| 2 2 2 | ||
| 3 3 3 | ||
| 5 5 5 | ||
| 6 6 6 | ||
| 7 7 7 | ||
| 8 8 8 | ||
| 9 9 9 | ||
|
|
||
| -- !sql -- | ||
| 1 1 1 | ||
| 2 2 2 | ||
| 8 8 8 | ||
| 9 9 9 | ||
|
|
||
| -- !sql -- | ||
| 1 1 1 0 | ||
| 2 2 2 0 | ||
| 3 3 3 0 | ||
| 4 4 4 0 | ||
| 5 5 5 0 | ||
| 6 6 6 0 | ||
| 7 7 7 0 | ||
| 8 8 8 0 | ||
| 9 9 9 0 | ||
|
|
||
| -- !sql -- | ||
| 1 1 1 | ||
| 2 2 2 | ||
| 4 4 4 | ||
| 5 5 5 | ||
| 8 8 8 | ||
| 9 9 9 | ||
|
|
||
| -- !sql -- | ||
| 1 1 1 | ||
| 2 2 2 | ||
| 4 4 4 | ||
| 8 8 8 | ||
| 9 9 9 | ||
|
|
||
| -- !sql -- | ||
| 1 1 1 0 | ||
| 2 2 2 0 | ||
| 3 3 3 0 | ||
| 4 4 4 0 | ||
| 4 4 4 0 | ||
| 5 5 5 0 | ||
| 5 5 5 0 | ||
| 6 6 6 0 | ||
| 7 7 7 0 | ||
| 8 8 8 0 | ||
| 9 9 9 0 | ||
|
|
||
| -- !sql -- | ||
| 1 1 10 | ||
|
|
||
| -- !sql -- | ||
| 1 1 5 0 3 5 | ||
| 1 1 10 0 2 10 | ||
|
|
||
| -- !sql -- | ||
|
|
||
| -- !sql -- | ||
| 1 1 5 0 3 5 | ||
| 1 1 10 0 2 10 | ||
|
|
||
| -- !sql -- | ||
| 1 1 10 | ||
|
|
||
| -- !sql -- | ||
| 1 1 5 0 3 5 | ||
| 1 1 10 0 2 10 | ||
|
|
||
| -- !sql -- | ||
|
|
||
| -- !sql -- | ||
| 1 \N \N 1 4 10 | ||
| 1 1 5 0 3 5 | ||
| 1 1 10 0 2 10 | ||
|
|
153 changes: 153 additions & 0 deletions
153
regression-test/suites/delete_p0/test_delete_on_value.groovy
This file contains hidden or 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,153 @@ | ||
| // 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_delete_on_value") { | ||
| sql 'set enable_nereids_planner=false' | ||
| sql "set experimental_enable_nereids_planner=false;" | ||
| sql 'set enable_nereids_dml=false' | ||
|
|
||
| sql "set skip_storage_engine_merge=false;" | ||
| sql "set skip_delete_bitmap=false;" | ||
| sql "set skip_delete_predicate=false;" | ||
| def tableName = "test_delete_on_value" | ||
| sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
| sql """ CREATE TABLE ${tableName} ( | ||
| `x` BIGINT NOT NULL, | ||
| `y` BIGINT NULL, | ||
| `z` BIGINT NULL) | ||
| ENGINE=OLAP | ||
| UNIQUE KEY(`x`) | ||
| COMMENT 'OLAP' | ||
| DISTRIBUTED BY HASH(`x`) BUCKETS 4 | ||
| PROPERTIES ( | ||
| "replication_num" = "1", | ||
| "enable_unique_key_merge_on_write" = "true" | ||
| );""" | ||
| sql """ insert into ${tableName} values(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6),(7,7,7),(8,8,8),(9,9,9); """ | ||
| qt_sql "select * from ${tableName} order by x,y,z;" | ||
| sql "delete from ${tableName} where y=4;" | ||
| qt_sql "select * from ${tableName} order by x,y,z;" | ||
| sql "delete from ${tableName} where z>=3 and z<=7;" | ||
| qt_sql "select * from ${tableName} order by x,y,z;" | ||
| sql "set skip_delete_predicate=true;" | ||
| qt_sql "select x,y,z,__DORIS_DELETE_SIGN__ from ${tableName} order by x,y,z,__DORIS_DELETE_SIGN__;" | ||
| sql "set skip_delete_predicate=false;" | ||
| sql "insert into ${tableName} values(4,4,4),(5,5,5);" | ||
| qt_sql "select * from ${tableName} order by x,y,z;" | ||
| sql "delete from ${tableName} where y=5;" | ||
| qt_sql "select * from ${tableName} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=true;" | ||
| sql "set skip_delete_bitmap=true;" | ||
| sql "set skip_delete_predicate=true;" | ||
| qt_sql "select x,y,z,__DORIS_DELETE_SIGN__ from ${tableName} order by x,y,z,__DORIS_DELETE_SIGN__;" | ||
| sql "DROP TABLE IF EXISTS ${tableName};" | ||
|
|
||
|
|
||
| def tableName2 = "test_delete_on_value2" | ||
| sql """ DROP TABLE IF EXISTS ${tableName2} """ | ||
| sql """ CREATE TABLE ${tableName2} ( | ||
| `x` BIGINT NOT NULL, | ||
| `y` BIGINT REPLACE_IF_NOT_NULL NULL, | ||
| `z` BIGINT REPLACE_IF_NOT_NULL NULL) | ||
| ENGINE=OLAP | ||
| AGGREGATE KEY(`x`) | ||
| COMMENT 'OLAP' | ||
| DISTRIBUTED BY HASH(`x`) BUCKETS 4 | ||
| PROPERTIES ( | ||
| "replication_num" = "1" | ||
| );""" | ||
| sql """ insert into ${tableName2} values(1,1,1); """ | ||
| test { | ||
| sql "delete from ${tableName2} where y=4;" | ||
| exception "delete predicate on value column only supports Unique table with merge-on-write enabled and Duplicate table, but Table[test_delete_on_value2] is an Aggregate table." | ||
| } | ||
|
|
||
| sql "set skip_storage_engine_merge=false;" | ||
| sql "set skip_delete_bitmap=false;" | ||
| sql "set skip_delete_predicate=false;" | ||
| def tableName3 = "test_delete_on_value_with_seq_col" | ||
| sql """ DROP TABLE IF EXISTS ${tableName3} """ | ||
| sql """ CREATE TABLE ${tableName3} ( | ||
| `x` BIGINT NOT NULL, | ||
| `y` BIGINT NULL, | ||
| `z` BIGINT NULL) | ||
| ENGINE=OLAP | ||
| UNIQUE KEY(`x`) | ||
| COMMENT 'OLAP' | ||
| DISTRIBUTED BY HASH(`x`) BUCKETS 4 | ||
| PROPERTIES ( | ||
| "replication_num" = "1", | ||
| "enable_unique_key_merge_on_write" = "true", | ||
| "function_column.sequence_col" = "z" | ||
| );""" | ||
| sql "insert into ${tableName3} values(1,1,10);" | ||
| sql "insert into ${tableName3} values(1,1,5);" | ||
| qt_sql "select * from ${tableName3} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=true;" | ||
| sql "set skip_delete_bitmap=true;" | ||
| sql "set skip_delete_predicate=true;" | ||
| qt_sql "select * from ${tableName3} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=false;" | ||
| sql "set skip_delete_bitmap=false;" | ||
| sql "set skip_delete_predicate=false;" | ||
| sql "delete from ${tableName3} where z>=10;" | ||
| qt_sql "select * from ${tableName3} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=true;" | ||
| sql "set skip_delete_bitmap=true;" | ||
| sql "set skip_delete_predicate=true;" | ||
| qt_sql "select * from ${tableName3} order by x,y,z;" | ||
| sql "DROP TABLE IF EXISTS ${tableName3}" | ||
|
|
||
| sql "set skip_storage_engine_merge=false;" | ||
| sql "set skip_delete_bitmap=false;" | ||
| sql "set skip_delete_predicate=false;" | ||
| def tableName4 = "test_delete_on_value_with_seq_col_mor" | ||
| sql """ DROP TABLE IF EXISTS ${tableName4} """ | ||
| sql """ CREATE TABLE ${tableName4} ( | ||
| `x` BIGINT NOT NULL, | ||
| `y` BIGINT NULL, | ||
| `z` BIGINT NULL) | ||
| ENGINE=OLAP | ||
| UNIQUE KEY(`x`) | ||
| COMMENT 'OLAP' | ||
| DISTRIBUTED BY HASH(`x`) BUCKETS 4 | ||
| PROPERTIES ( | ||
| "replication_num" = "1", | ||
| "function_column.sequence_col" = "z" | ||
| );""" | ||
| sql "insert into ${tableName4} values(1,1,10);" | ||
| sql "insert into ${tableName4} values(1,1,5);" | ||
| qt_sql "select * from ${tableName4} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=true;" | ||
| sql "set skip_delete_bitmap=true;" | ||
| sql "set skip_delete_predicate=true;" | ||
| qt_sql "select * from ${tableName4} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=false;" | ||
| sql "set skip_delete_bitmap=false;" | ||
| sql "set skip_delete_predicate=false;" | ||
| sql "delete from ${tableName4} where z>=10;" | ||
| qt_sql "select * from ${tableName4} order by x,y,z;" | ||
| sql "set skip_storage_engine_merge=true;" | ||
| sql "set skip_delete_bitmap=true;" | ||
| sql "set skip_delete_predicate=true;" | ||
| qt_sql "select * from ${tableName4} order by x,y,z;" | ||
| sql "DROP TABLE IF EXISTS ${tableName4};" | ||
|
|
||
| sql "set skip_storage_engine_merge=false;" | ||
| sql "set skip_delete_bitmap=false;" | ||
| sql "set skip_delete_predicate=false;" | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.