This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new d1ecb320a9d branch-3.0: [fix](schema-change) Fix single column table
could not rename columns #47275 (#52340)
d1ecb320a9d is described below
commit d1ecb320a9d46d7e41c1fde0814af2cb8ababdfc
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jun 26 22:22:17 2025 +0800
branch-3.0: [fix](schema-change) Fix single column table could not rename
columns #47275 (#52340)
Cherry-picked from #47275
Co-authored-by: Siyang Tang <[email protected]>
---
.../main/java/org/apache/doris/catalog/Env.java | 4 +--
.../test_rename_single_col_tbl.out | Bin 0 -> 196 bytes
.../test_rename_single_col_tbl.groovy | 37 +++++++++++++++++++++
3 files changed, 39 insertions(+), 2 deletions(-)
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 eeb86251613..ee74323ddfa 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 @@ public class Env {
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'.");
}
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 00000000000..aea2129c772
Binary files /dev/null and
b/regression-test/data/schema_change_p0/test_rename_single_col_tbl.out differ
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 00000000000..8183b2878a1
--- /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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]