[Bug](decimalv3) select view of decimalv3 error (#15404)

This commit is contained in:
HappenLee
2022-12-28 08:38:33 +08:00
committed by GitHub
parent 5ac7b09765
commit 22b31e516c
3 changed files with 47 additions and 3 deletions

View File

@ -557,9 +557,6 @@ public class ScalarType extends Type {
}
break;
case DECIMALV2:
case DECIMAL32:
case DECIMAL64:
case DECIMAL128:
if (Strings.isNullOrEmpty(precisionStr)) {
stringBuilder.append("decimal").append("(").append(precision)
.append(", ").append(scale).append(")");
@ -570,6 +567,20 @@ public class ScalarType extends Type {
stringBuilder.append("decimal").append("(`").append(precisionStr).append("`)");
}
break;
case DECIMAL32:
case DECIMAL64:
case DECIMAL128:
String typeName = Config.enable_decimal_conversion ? "decimal" : "decimalv3";
if (Strings.isNullOrEmpty(precisionStr)) {
stringBuilder.append(typeName).append("(").append(precision)
.append(", ").append(scale).append(")");
} else if (!Strings.isNullOrEmpty(precisionStr) && !Strings.isNullOrEmpty(scaleStr)) {
stringBuilder.append(typeName).append("(`").append(precisionStr)
.append("`, `").append(scaleStr).append("`)");
} else {
stringBuilder.append(typeName).append("(`").append(precisionStr).append("`)");
}
break;
case DATETIMEV2:
stringBuilder.append("datetime").append("(").append(scale).append(")");
break;