Get precise precision for Decimal literal in FieldToDataType
and DecimalField::getPrec
#5007
Labels
type/enhancement
The issue or PR belongs to an enhancement.
Enhancement
In
FieldToDataType
For a Decimal literal, its precision is always the max precision of the Decimal type.(9 for Decimal32, 18 for Decimal64, 38 for Decimal128 and 65 for Decimal256). But, for a decimal literal, we can always get its precise precision, no need to use the upper bound.
In
DecimalField::getPrec
As we can see, if the
dec.value == 0
, the prec is 1, if the scale is 2, then the (prec, scale) will be (1,2) which is not valid, so we should returnstd::max(cnt, scale)
as its prec.The text was updated successfully, but these errors were encountered: