[fix](planner)decimalv3 literal's precision and scale is not correctly set (#32288)

This commit is contained in:
starocean999
2024-03-19 10:09:14 +08:00
committed by yiguolei
parent 353add74db
commit 6aec479013
4 changed files with 30 additions and 2 deletions

View File

@ -310,6 +310,9 @@ public class DecimalLiteral extends NumericLiteralExpr {
int integerPart = Math.max(this.value.precision() - this.value.scale(),
type.getPrecision() - ((ScalarType) type).decimalScale());
this.type = ScalarType.createDecimalV3Type(integerPart + scale, scale);
BigDecimal adjustedValue = value.scale() < 0 ? value
: value.setScale(scale, RoundingMode.HALF_UP);
this.value = Objects.requireNonNull(adjustedValue);
}
}