Skip to content
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

[chore][test] add testcase for recycle bin #44815

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_check_1 --
1 a 2022-01-02
2 a 2023-01-02
3 a 2024-01-02

-- !select_check_2 --
3 a 2024-01-02

-- !select_check_recover_1_value4 --
4 a 2024-01-02

-- !select_check_recover_2_value3 --
3 a 2024-01-02

-- !select_check_recover_3_value123 --
1 a 2022-01-02
2 a 2023-01-02
3 a 2024-01-02

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_check_1 --
1 a 2022-01-02
2 a 2023-01-02
3 a 2024-01-02

-- !select_check_2 --
3 a 2024-01-02

-- !select_check_3 --
4 a 2024-01-02

-- !select_check_recover_1_value4 --
4 a 2024-01-02

-- !select_check_recover_2_value3 --
3 a 2024-01-02

-- !select_check_recover_3_value123 --
1 a 2022-01-02
2 a 2023-01-02
3 a 2024-01-02

Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// 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_create_drop_multiple") {
def table = "test_create_drop_multiple"

// create table and insert data
sql """ drop table if exists ${table}"""
sql """
create table ${table} (
`id` int(11),
`name` varchar(128),
`da` date
)
engine=olap
duplicate key(id)
partition by range(da)(
PARTITION p3 VALUES LESS THAN ('2023-01-01'),
PARTITION p4 VALUES LESS THAN ('2024-01-01'),
PARTITION p5 VALUES LESS THAN ('2025-01-01')
)
distributed by hash(id) buckets 2
properties(
"replication_num"="1",
"light_schema_change"="true"
);
"""

sql """ insert into ${table} values(1, 'a', '2022-01-02'); """
sql """ insert into ${table} values(2, 'a', '2023-01-02'); """
sql """ insert into ${table} values(3, 'a', '2024-01-02'); """
sql """ SYNC;"""

qt_select_check_1 """ select * from ${table} order by id,name,da; """

sql """ drop table ${table}; """

sql """
create table ${table} (
`id` int(11),
`name` varchar(128),
`da` date
)
engine=olap
duplicate key(id)
partition by range(da)(
PARTITION p3 VALUES LESS THAN ('2023-01-01'),
PARTITION p4 VALUES LESS THAN ('2024-01-01'),
PARTITION p5 VALUES LESS THAN ('2025-01-01')
)
distributed by hash(id) buckets 2
properties(
"replication_num"="1",
"light_schema_change"="true"
);
"""
sql """ insert into ${table} values(3, 'a', '2024-01-02'); """
sql """ SYNC;"""
qt_select_check_2 """ select * from ${table} order by id,name,da; """
sql """ drop table ${table}; """
sql """
create table ${table} (
`id` int(11),
`name` varchar(128),
`da` date
)
engine=olap
duplicate key(id)
partition by range(da)(
PARTITION p3 VALUES LESS THAN ('2023-01-01'),
PARTITION p4 VALUES LESS THAN ('2024-01-01'),
PARTITION p5 VALUES LESS THAN ('2025-01-01')
)
distributed by hash(id) buckets 2
properties(
"replication_num"="1",
"light_schema_change"="true"
);
"""
sql """ insert into ${table} values(4, 'a', '2024-01-02'); """
sql """ SYNC;"""
sql """ drop table ${table}; """
sql """ recover table ${table}; """

qt_select_check_recover_1_value4 """ select * from ${table} order by id,name,da; """
sql """ drop table ${table} force; """
sql """ recover table ${table}; """
qt_select_check_recover_2_value3 """ select * from ${table} order by id,name,da; """
sql """ drop table ${table} force; """
sql """ recover table ${table}; """
qt_select_check_recover_3_value123 """ select * from ${table} order by id,name,da; """
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// 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_insert_overwrite_recover_multiple") {
def table = "test_insert_overwrite_recover_multiple"

// create table and insert data
sql """ drop table if exists ${table}"""
sql """
create table ${table} (
`id` int(11),
`name` varchar(128),
`da` date
)
engine=olap
duplicate key(id)
partition by range(da)(
PARTITION p3 VALUES LESS THAN ('2023-01-01'),
PARTITION p4 VALUES LESS THAN ('2024-01-01'),
PARTITION p5 VALUES LESS THAN ('2025-01-01')
)
distributed by hash(id) buckets 2
properties(
"replication_num"="1",
"light_schema_change"="true"
);
"""

sql """ insert into ${table} values(1, 'a', '2022-01-02'); """
sql """ insert into ${table} values(2, 'a', '2023-01-02'); """
sql """ insert into ${table} values(3, 'a', '2024-01-02'); """
sql """ SYNC;"""

qt_select_check_1 """ select * from ${table} order by id,name,da; """

sql """ insert overwrite table ${table} values(3, 'a', '2024-01-02'); """

qt_select_check_2 """ select * from ${table} order by id,name,da; """

sql """ insert overwrite table ${table} values(4, 'a', '2024-01-02'); """

qt_select_check_3 """ select * from ${table} order by id,name,da; """

sql """ ALTER TABLE ${table} DROP PARTITION p3; """
sql """ ALTER TABLE ${table} DROP PARTITION p4; """
sql """ ALTER TABLE ${table} DROP PARTITION p5; """

sql """ recover partition p3 from ${table}; """
sql """ recover partition p4 from ${table}; """
sql """ recover partition p5 from ${table}; """

qt_select_check_recover_1_value4 """ select * from ${table} order by id,name,da; """
sql """ ALTER TABLE ${table} DROP PARTITION p3 force; """
sql """ ALTER TABLE ${table} DROP PARTITION p4 force; """
sql """ ALTER TABLE ${table} DROP PARTITION p5 force; """

sql """ recover partition p3 from ${table}; """
sql """ recover partition p4 from ${table}; """
sql """ recover partition p5 from ${table}; """

qt_select_check_recover_2_value3 """ select * from ${table} order by id,name,da; """
sql """ ALTER TABLE ${table} DROP PARTITION p3 force; """
sql """ ALTER TABLE ${table} DROP PARTITION p4 force; """
sql """ ALTER TABLE ${table} DROP PARTITION p5 force; """

sql """ recover partition p3 from ${table}; """
sql """ recover partition p4 from ${table}; """
sql """ recover partition p5 from ${table}; """

qt_select_check_recover_3_value123 """ select * from ${table} order by id,name,da; """


}
Loading