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

CAST(varchar_expr AS DECIMAL(M,N)) returns a wrong result

Details

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(10)) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('10.1');
      SELECT
        a,
        CAST(a AS DECIMAL(10,1)),
        CAST(a AS DECIMAL(10,2)),
        CAST(a AS DECIMAL(10,3))
      FROM t1;
      

      +------+--------------------------+--------------------------+--------------------------+
      | a    | CAST(a AS DECIMAL(10,1)) | CAST(a AS DECIMAL(10,2)) | CAST(a AS DECIMAL(10,3)) |
      +------+--------------------------+--------------------------+--------------------------+
      | 10.1 |                     10.1 |                    10.01 |                   10.001 |
      +------+--------------------------+--------------------------+--------------------------+
      

      Expected to get '10.10' and '10.100' in the third and the fourth column.

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.