bamaer commented on PR #9298: URL: https://github.com/apache/hop/pull/9298#issuecomment-6678153964
Thanks @hansva, the crash fix works: I built the PR, ran the denormaliser tests, and the new test fails without the fix. **Blocker** - [Denormaliser.java:251](https://github.com/apache/hop/blob/95b1018ec0c9903aa1fe9d832a2159aeb74c8e01/plugins/transforms/denormaliser/src/main/java/org/apache/hop/pipeline/transforms/denormaliser/Denormaliser.java#L251): `divideBigDecimals` also rounds averages that are exact today, so working pipelines silently change output after upgrading: 3/2 goes from `1.5` to `2`, 15/4 from `3.75` to `3.8`, 99/8 from `12.375` to `12`. Suggest keeping the exact result when there is one and rounding only the case that used to throw: ```java case BigDecimal bd -> averageOf(bd, count); ... private static BigDecimal averageOf(BigDecimal sum, long count) { BigDecimal divisor = BigDecimal.valueOf(count); try { return sum.divide(divisor); } catch (ArithmeticException e) { return ValueDataUtil.divideBigDecimals(sum, divisor, null); } } ``` The test's 3/2 assertion then expects `1.5`; with that change all denormaliser tests pass locally. Could the Group by / Memory group by precision review get its own issue, so the test comment can point to it instead of "step 6"? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
