Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4660

Narow decimal to string conversion is inconsistent about zero integral

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.6.1, 6.1.1
    • Fix Version/s: 6.1.1
    • Component/s: PrimProc
    • Labels:
      None

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(10,3)) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES (0),(0.009),(0.09),(0.9);
      SELECT CONCAT(a), CAST(a AS CHAR) FROM t1;
      

      +-----------+-----------------+
      | CONCAT(a) | CAST(a AS CHAR) |
      +-----------+-----------------+
      | 0.000     | 0.000           |
      | .009      | .009            |
      | .090      | .090            |
      | 0.900     | 0.900           |
      +-----------+-----------------+
      

      Notice inconsistency:

      • it prints the 0 in the integral part if the first fractional digit is not 0.
      • it does not print the 0 in the integral part if the first fractional digit is zero.

      Note, the problem is not repeatable with wide decimal:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(30,3)) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES (0),(0.009),(0.09),(0.9);
      SELECT CONCAT(a), CAST(a AS CHAR) FROM t1;
      

      +-----------+-----------------+
      | CONCAT(a) | CAST(a AS CHAR) |
      +-----------+-----------------+
      | 0.000     | 0.000           |
      | 0.009     | 0.009           |
      | 0.090     | 0.090           |
      | 0.900     | 0.900           |
      +-----------+-----------------+
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dleeyh Daniel Lee
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration