Skip to content

Commit fb0e10b

Browse files
committed
[enhancement](regression-test) Add regression test about modifying partition and distribution column
1 parent ceebf3f commit fb0e10b

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
suite("test_modify_partition_or_distribution_column") {
19+
def tblName = "test_modify_partition_or_distribution_column"
20+
sql """ DROP TABLE IF EXISTS ${tblName} """
21+
sql """
22+
CREATE TABLE IF NOT EXISTS ${tblName}
23+
(
24+
k1 DATE,
25+
k2 INT DEFAULT '10',
26+
k3 bigint,
27+
k4 VARCHAR(32) DEFAULT '',
28+
v1 BIGINT DEFAULT '0'
29+
)
30+
UNIQUE KEY(k1, k2, k3, k4)
31+
PARTITION BY RANGE(`k2`)
32+
(
33+
partition `old_p1` values [("1"), ("2")),
34+
partition `old_p2` values [("2"), ("3"))
35+
)
36+
DISTRIBUTED BY HASH(k3, k4) BUCKETS 5
37+
PROPERTIES("replication_num" = "1", "light_schema_change" = "true");
38+
"""
39+
40+
test {
41+
sql """ ALTER TABLE ${tblName} MODIFY COLUMN k2 INT NOT NULL """
42+
exception "Can not modify partition or distribution column"
43+
}
44+
45+
test {
46+
sql """ ALTER TABLE ${tblName} MODIFY COLUMN k3 largeint """
47+
exception "Can not modify partition or distribution column"
48+
}
49+
}

regression-test/suites/schema_change_p0/test_varchar_schema_change.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ suite ("test_varchar_schema_change") {
6464
// exception "Nothing is changed"
6565
// }
6666

67+
test {
68+
sql """ alter table ${tableName} modify column c2 varchar(65536) """
69+
70+
exception "VARCHAR size must be <= 65533"
71+
}
72+
6773
sql """ alter table ${tableName} modify column c2 varchar(30) """
6874
int max_try_secs = 300
6975
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {

0 commit comments

Comments
 (0)