From e4c7d4d03ac3d01a43ec7d4ec35d125aacba19f5 Mon Sep 17 00:00:00 2001 From: zhiqiang Date: Fri, 22 Dec 2023 12:48:20 +0800 Subject: [PATCH] [chore](error msg) print type info when colocate with ddl failed due to type mismatch (#28773) --- .../java/org/apache/doris/catalog/ColocateGroupSchema.java | 5 ++++- .../java/org/apache/doris/catalog/ColocateTableTest.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java index 57d512b978..32c48c5fba 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java @@ -105,8 +105,11 @@ public class ColocateGroupSchema implements Writable { continue; } if (!targetColType.equals(info.getDistributionColumns().get(i).getType())) { + String typeName = info.getDistributionColumns().get(i).getType().toString(); + String colName = info.getDistributionColumns().get(i).getName(); + String formattedString = colName + "(" + typeName + ")"; ErrorReport.reportDdlException(ErrorCode.ERR_COLOCATE_TABLE_MUST_HAS_SAME_DISTRIBUTION_COLUMN_TYPE, - info.getDistributionColumns().get(i).getName(), targetColType); + formattedString, targetColType); } } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/ColocateTableTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/ColocateTableTest.java index 8e13b1467e..4ea69f0394 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/ColocateTableTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/ColocateTableTest.java @@ -310,7 +310,7 @@ public class ColocateTableTest { + ");"); expectedEx.expect(DdlException.class); - expectedEx.expectMessage("Colocate tables distribution columns must have the same data type: k2 should be INT"); + expectedEx.expectMessage("Colocate tables distribution columns must have the same data type: k2(VARCHAR(10)) should be INT"); createTable("create table " + dbName + "." + tableName2 + " (\n" + " `k1` int NULL COMMENT \"\",\n" + " `k2` varchar(10) NULL COMMENT \"\"\n"