Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-13462

[DV] FORMAT functions return different results with java 8 and 11

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Activity

          People

            broldan@redhat.com Robert Roldan
            mmajerni@redhat.com Mario Majernik
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: