[Fix](planner) fix bug of char(255) toSql (#37340) (#37671)

cherry-pick #37340 from master
This commit is contained in:
feiniaofeiafei
2024-07-12 10:33:24 +08:00
committed by GitHub
parent 4dc933bb28
commit 6214d6421f
6 changed files with 65 additions and 5 deletions

View File

@ -579,7 +579,7 @@ public class ScalarType extends Type {
public String toString() {
if (type == PrimitiveType.CHAR) {
if (isWildcardChar()) {
return "CHARACTER";
return "CHARACTER(" + MAX_CHAR_LENGTH + ")";
}
return "CHAR(" + len + ")";
} else if (type == PrimitiveType.DECIMALV2) {
@ -617,7 +617,7 @@ public class ScalarType extends Type {
switch (type) {
case CHAR:
if (isWildcardChar()) {
stringBuilder.append("CHARACTER");
stringBuilder.append("CHARACTER").append("(").append(MAX_CHAR_LENGTH).append(")");
} else if (Strings.isNullOrEmpty(lenStr)) {
stringBuilder.append("CHAR").append("(").append(len).append(")");
} else {