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

Narow decimal to string conversion is inconsistent about zero integral

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.6.1, 6.1.1
    • 6.1.1
    • PrimProc
    • 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

              dleeyh Daniel Lee (Inactive)
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.