diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java index eeb86251613ef3..ee74323ddfa6f7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java @@ -5142,8 +5142,8 @@ private void renameColumn(Database db, OlapTable table, String colName, Map indexIdToMeta = table.getIndexIdToMeta(); for (Map.Entry entry : indexIdToMeta.entrySet()) { - // rename column is not implemented for table without column unique id. - if (entry.getValue().getMaxColUniqueId() <= 0) { + // rename column is not implemented for non-light-schema-change table. + if (!table.getEnableLightSchemaChange()) { throw new DdlException("not implemented for table without column unique id," + " which are created with property 'light_schema_change'."); } diff --git a/regression-test/data/schema_change_p0/test_rename_single_col_tbl.out b/regression-test/data/schema_change_p0/test_rename_single_col_tbl.out new file mode 100644 index 00000000000000..aea2129c772424 --- /dev/null +++ b/regression-test/data/schema_change_p0/test_rename_single_col_tbl.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !desc -- +test_rename_single_col_tbl DUP_KEYS rename_partition_col DATE datev2 No true \N true + diff --git a/regression-test/suites/schema_change_p0/test_rename_single_col_tbl.groovy b/regression-test/suites/schema_change_p0/test_rename_single_col_tbl.groovy new file mode 100644 index 00000000000000..8183b2878a17d4 --- /dev/null +++ b/regression-test/suites/schema_change_p0/test_rename_single_col_tbl.groovy @@ -0,0 +1,37 @@ +// 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_rename_single_col_tbl") { + def tblName = "test_rename_single_col_tbl" + sql """ DROP TABLE IF EXISTS ${tblName} """ + sql """ + CREATE TABLE ${tblName} + ( + col0 DATE NOT NULL, + ) + DUPLICATE KEY(col0) + DISTRIBUTED BY HASH(col0) BUCKETS 4 + PROPERTIES ( + "replication_num" = "1" + ); + """ + sql """ + ALTER TABLE ${tblName} RENAME COLUMN col0 rename_partition_col + """ + sql """ SYNC """ + qt_desc """ DESC ${tblName} ALL """ +} \ No newline at end of file