This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0-beta in repository https://gitbox.apache.org/repos/asf/doris.git
commit 243d3a5ce998e386f79fb19f9bda59294c27985c Author: xueweizhang <zxw520bl...@163.com> AuthorDate: Fri Jun 9 09:34:55 2023 +0800 [fix](replay) fix truncate partition name need case insensitive (#20098) truncate table with partition name need case insensitive --- .../apache/doris/datasource/InternalCatalog.java | 2 +- .../suites/ddl_p0/test_truncate_table.groovy | 63 ++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java index 1fc3b20bcc..b56c911c25 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java @@ -2623,7 +2623,7 @@ public class InternalCatalog implements CatalogIf<Database> { TableName dbTbl = tblRef.getName(); // check, and save some info which need to be checked again later - Map<String, Long> origPartitions = Maps.newHashMap(); + Map<String, Long> origPartitions = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); Map<Long, DistributionInfo> partitionsDistributionInfo = Maps.newHashMap(); OlapTable copiedTbl; diff --git a/regression-test/suites/ddl_p0/test_truncate_table.groovy b/regression-test/suites/ddl_p0/test_truncate_table.groovy new file mode 100644 index 0000000000..e983915f22 --- /dev/null +++ b/regression-test/suites/ddl_p0/test_truncate_table.groovy @@ -0,0 +1,63 @@ +// 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_truncate_table") { + def testTable = "test_truncate_table" + + sql "DROP TABLE IF EXISTS ${testTable}" + + sql """ + CREATE TABLE ${testTable} + ( + k1 DATE, + k2 DECIMAL(10, 2) DEFAULT "10.5", + k3 CHAR(10) COMMENT "string column", + k4 INT NOT NULL DEFAULT "1" COMMENT "int column" + ) + PARTITION BY RANGE(k1) + ( + PARTITION p1 VALUES LESS THAN ("2020-02-01"), + PARTITION p2 VALUES LESS THAN ("2020-03-01"), + PARTITION p3 VALUES LESS THAN ("2020-04-01") + ) + DISTRIBUTED BY HASH(k2) BUCKETS 32 + PROPERTIES ( + "replication_num" = "1" + ); + """ + List<List<Object>> result = sql "show partitions from ${testTable}" + logger.info("${result}") + assertEquals(result.size(), 3) + assertEquals(result.get(0).get(1), "p1") + + sql """truncate table ${testTable};""" + result = sql "show partitions from ${testTable}" + logger.info("${result}") + assertEquals(result.size(), 3) + assertEquals(result.get(0).get(1), "p1") + + sql """truncate table ${testTable} partitions (p1, P1);""" + + result = sql "show partitions from ${testTable}" + logger.info("${result}") + assertEquals(result.size(), 3) + assertEquals(result.get(0).get(1), "p1") + + sql "DROP TABLE IF EXISTS ${testTable}" +} + --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org