Browse Source
Merge fix-sum-overflow (lts-4.2) into lts-4.3 and adapt to the 4.3 code structure. In 4.3 the rounding is centralized in NumberUtils.roundResult (not TbUtils.toInt as in 4.2), so the fix moves there: rename toInt(double) to toLong(double) and have the precision=0 path return a long. BigDecimal.intValue() returned only the low-order 32 bits, so a calculated field SUM above ~2.1B wrapped to a negative number (e.g. 3,980,173,734 -> -314,793,562) when "Decimals by default" was 0 (the UI default). The 4.2 TbUtils.toLong addition is dropped since TbUtils.toInt is not used in 4.3 (CF rounding flows through NumberUtils only). SimpleCalculatedFieldState.createResultJson gains a Long branch so the JSON node is emitted as a numeric long; the aggregation path already routes through JacksonUtil.toString, which handles Long transparently.pull/15621/head
3 changed files with 12 additions and 8 deletions
Loading…
Reference in new issue