Skip to content

Commit

Permalink
[chore](error msg) print type info when colocate with ddl failed due …
Browse files Browse the repository at this point in the history
…to type mismatch (#28773)
  • Loading branch information
zhiqiang-hhhh committed Dec 22, 2023
1 parent f0a9d34 commit 8162172
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ public void checkDistribution(DistributionInfo distributionInfo) throws DdlExcep
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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void testDistributionColumnsType() throws Exception {
+ ");");

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"
Expand Down

0 comments on commit 8162172

Please sign in to comment.