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

ROUND(d1,38)/TRUNCATE(d1,38) where d1 is DECIMAL(38)/DECIMAL(38,10) gives wrong results.

    XMLWordPrintable

Details

    • 2021-17

    Description

      MariaDB [test]> drop table if exists cs1;
      Query OK, 0 rows affected (0.293 sec)
       
      MariaDB [test]> create table cs1(d1 decimal(38,10))engine=columnstore;
      Query OK, 0 rows affected (0.258 sec)
       
      MariaDB [test]> insert into cs1 values (9999999999999999999999999999.9999999999), (1234567890123456789012345678.9012345678);
      Query OK, 2 rows affected (0.293 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> select round(d1, 38), truncate(d1, 38) from cs1;
      +--------------------------------------------------------------------+--------------------------------------------------------------------+
      | round(d1, 38)                                                      | truncate(d1, 38)                                                   |
      +--------------------------------------------------------------------+--------------------------------------------------------------------+
      | 999999999999999999999999999.99999999999999999999999999999999999999 | 999999999999999999999999999.99999999999999999999999999999999999999 |
      | 999999999999999999999999999.99999999999999999999999999999999999999 | 999999999999999999999999999.99999999999999999999999999999999999999 |
      +--------------------------------------------------------------------+--------------------------------------------------------------------+
      2 rows in set (0.093 sec)
       
      The expected results are:
      MariaDB [test]> select round(d1, 38), truncate(d1, 38) from cs1;
      +---------------------------------------------------------------------+---------------------------------------------------------------------+
      | round(d1, 38)                                                       | truncate(d1, 38)                                                    |
      +---------------------------------------------------------------------+---------------------------------------------------------------------+
      | 9999999999999999999999999999.99999999990000000000000000000000000000 | 9999999999999999999999999999.99999999990000000000000000000000000000 |
      | 1234567890123456789012345678.90123456780000000000000000000000000000 | 1234567890123456789012345678.90123456780000000000000000000000000000 |
      +---------------------------------------------------------------------+---------------------------------------------------------------------+
      2 rows in set (0.001 sec)
       
      MariaDB [test]> drop table if exists cs1;
      Query OK, 0 rows affected (0.235 sec)
       
      MariaDB [test]> CREATE TABLE cs1 (d1 DECIMAL(38)) ENGINE=columnstore;
      Query OK, 0 rows affected (0.166 sec)
       
      MariaDB [test]> INSERT INTO cs1 VALUES (9999999999999999999999999999999999999);
      Query OK, 1 row affected (0.171 sec)
       
      MariaDB [test]> select round(d1, 38), truncate(d1, 38) from cs1;
      +--------------------------------------------------------------------+--------------------------------------------------------------------+
      | round(d1, 38)                                                      | truncate(d1, 38)                                                   |
      +--------------------------------------------------------------------+--------------------------------------------------------------------+
      | 999999999999999999999999999.99999999999999999999999999999999999999 | 999999999999999999999999999.99999999999999999999999999999999999999 |
      +--------------------------------------------------------------------+--------------------------------------------------------------------+
      1 row in set (0.114 sec)
       
      MariaDB [test]> select round(d1, 38), truncate(d1, 38) from cs1;
      +----------------------------------------------------------------------------+----------------------------------------------------------------------------+
      | round(d1, 38)                                                              | truncate(d1, 38)                                                           |
      +----------------------------------------------------------------------------+----------------------------------------------------------------------------+
      | 9999999999999999999999999999999999999.000000000000000000000000000000000000 | 9999999999999999999999999999999999999.000000000000000000000000000000000000 |
      +----------------------------------------------------------------------------+----------------------------------------------------------------------------+
      1 row in set (0.001 sec)
      
      

      Attachments

        Issue Links

          Activity

            People

              tntnatbry Gagan Goel (Inactive)
              tntnatbry Gagan Goel (Inactive)
              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.