-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Queries with format functions (FORMATBIGDECIMAL, FORMATDOUBLE ...) return different results for negative numbers.
Example:
SELECT FORMATBIGDECIMAL((99 - 10000000), '#,##0;###0-')
dv operator with java 8 return: -9,999,901
dv operator with java 11 return: 9,999,901-
asmigala@redhat.com found out that difference is in java versions:
String pattern = "#,##0;###0-"; BigDecimal num = new BigDecimal(99 - 10000000); NumberFormat format = new DecimalFormat(pattern); StringBuffer buf = new StringBuffer(); Assertions.assertThat(format.format(num, buf, new FieldPosition(0))).startsWith("-");
The check passes on java 8 but fails on java 11.
The question is if the results difference is desirable or not. If not which result is correct.