Ada Wong created FLINK-25434: -------------------------------- Summary: Throw an error when BigDecimal precision overflows. Key: FLINK-25434 URL: https://issues.apache.org/jira/browse/FLINK-25434 Project: Flink Issue Type: Bug Components: Table SQL / Planner, Table SQL / Runtime Affects Versions: 1.14.2 Reporter: Ada Wong
Lost a lot of data but no error was thrown. As the following comment, If the precision overflows, null will be returned. {code:java} /** 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); } {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)