|
| 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 | +} |
0 commit comments