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

FROM_UNIXTIME() returns a bad result for DECIMAL input

    XMLWordPrintable

Details

    Description

      SET time_zone='+00:00';
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(18,7)) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES (1000000000.3);
      SELECT FROM_UNIXTIME(a) FROM t1;
      

      +----------------------------+
      | FROM_UNIXTIME(a)           |
      +----------------------------+
      | 2001-09-09 06:46:40.902848 |
      +----------------------------+
      

      The fractional part looks wrong.

      If I run the same script with MyISAM (or any other engine), the result is as follows:

      SET time_zone='+00:00';
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(18,7)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1000000000.3);
      SELECT FROM_UNIXTIME(a) FROM t1;
      

      +----------------------------+
      | FROM_UNIXTIME(a)           |
      +----------------------------+
      | 2001-09-09 01:46:40.300000 |
      +----------------------------+
      

      Looks correct.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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