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

      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)
       
      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)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tntnatbry Gagan Goel
              Reporter:
              tntnatbry Gagan Goel
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: