Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
1.14.2
-
None
-
None
Description
Lost a lot of data but no error was thrown.
As the following comment, If the precision overflows, null will be returned.
/** If the precision overflows, null will be returned. */ public static @Nullable DecimalData fromBigDecimal(BigDecimal bd, int precision, int scale) { bd = bd.setScale(scale, RoundingMode.HALF_UP); if (bd.precision() > precision) { return null; } long longVal = -1; if (precision <= MAX_COMPACT_PRECISION) { longVal = bd.movePointRight(scale).longValueExact(); } return new DecimalData(precision, scale, longVal, bd); }
Attachments
Attachments
Issue Links
- duplicates
-
FLINK-24420 Casting to a "narrower" type doesn't throw exception but follows Java overflow
- Open
-
FLINK-24847 Decide the overflows behaviour
- Open