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

branch-3.0: [fix](schema-change) Fix single column table could not rename columns #47275 #47430

Open
wants to merge 1 commit into
base: branch-3.0
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -5091,8 +5091,8 @@ private void renameColumn(Database db, OlapTable table, String colName,

Map<Long, MaterializedIndexMeta> indexIdToMeta = table.getIndexIdToMeta();
for (Map.Entry<Long, MaterializedIndexMeta> 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'.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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 """
}
Loading