[Bug](type) fix wildcard char's tostring get wrong result (#24041)

fix wildcard char's tostring get wrong result
This commit is contained in:
Pxl
2023-09-07 20:25:38 +08:00
committed by GitHub
parent f0bd2c9c53
commit ab7c2b9d22
4 changed files with 12 additions and 4 deletions

View File

@ -532,7 +532,7 @@ public class ScalarType extends Type {
public String toString() {
if (type == PrimitiveType.CHAR) {
if (isWildcardChar()) {
return "CHAR(*)";
return "CHARACTER";
}
return "CHAR(" + len + ")";
} else if (type == PrimitiveType.DECIMALV2) {
@ -567,7 +567,9 @@ public class ScalarType extends Type {
StringBuilder stringBuilder = new StringBuilder();
switch (type) {
case CHAR:
if (Strings.isNullOrEmpty(lenStr)) {
if (isWildcardVarchar()) {
stringBuilder.append("character");
} else if (Strings.isNullOrEmpty(lenStr)) {
stringBuilder.append("char").append("(").append(len).append(")");
} else {
stringBuilder.append("char").append("(`").append(lenStr).append("`)");