Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4346

strange result in toString function with bigdecimal type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 1.27.0
    • core
    • None

    Description

      In  SqlFunctions the toString function with BigDecimal type will replace 0.1 with .1 .

      But why is this ?

      public static String toString(BigDecimal x) {
       final String s = x.toString();
       if (s.equals("0")) {
       return s;
       } else if (s.startsWith("0.")) {
       // we want ".1" not "0.1"
       return s.substring(1);
       } else if (s.startsWith("-0.")) {
       // we want "-.1" not "-0.1"
       return "-" + s.substring(2);
       } else {
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Zhixiong Chen Zhixiong Chen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: