This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 1d34eaefdc8 [fix](schema-change) Fix single column table could not
rename columns (#47275)
1d34eaefdc8 is described below
commit 1d34eaefdc8834332974025159aadb248c72e714
Author: Siyang Tang <[email protected]>
AuthorDate: Fri Jan 24 18:18:44 2025 +0800
[fix](schema-change) Fix single column table could not rename columns
(#47275)
Single column tables was not able to rename column due to light schema
change check in error way.
---
.../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 fdfd1e3e9e2..548c427a9bf 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
@@ -5126,8 +5126,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]