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

CAST(hugeNegativeWideDecimal AS SIGNED) returns 0 or NULL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.6.1, 6.1.1
    • Fix Version/s: 6.3.1
    • Component/s: PrimProc
    • Labels:
      None

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (d1 DECIMAL(30,0), d2 DECIMAL(30,0) NOT NULL) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES (-1e20,-1e20),(1e20,1e20);
      SELECT d1, CAST(d1 AS SIGNED), CAST(d2 AS SIGNED) FROM t1;
      

      +------------------------+---------------------+---------------------+
      | d1                     | CAST(d1 AS SIGNED)  | CAST(d2 AS SIGNED)  |
      +------------------------+---------------------+---------------------+
      | -100000000000000000000 |                NULL |                   0 |
      |  100000000000000000000 | 9223372036854775807 | 9223372036854775807 |
      +------------------------+---------------------+---------------------+
      

      The expected result is:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (d1 DECIMAL(30,0), d2 DECIMAL(30,0) NOT NULL) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (-1e20,-1e20),(1e20,1e20);
      SELECT d1, CAST(d1 AS SIGNED), CAST(d2 AS SIGNED) FROM t1;
      

      +------------------------+----------------------+----------------------+
      | d1                     | CAST(d1 AS SIGNED)   | CAST(d2 AS SIGNED)   |
      +------------------------+----------------------+----------------------+
      | -100000000000000000000 | -9223372036854775808 | -9223372036854775808 |
      |  100000000000000000000 |  9223372036854775807 |  9223372036854775807 |
      +------------------------+----------------------+----------------------+
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:

                  Git Integration