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

CAST(UBIGINTNULL_inWideDecimal AS UNSIGNED) returns 0 or NULL

    XMLWordPrintable

Details

    • 2023-8

    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 (18446744073709551614,18446744073709551614);
      SELECT d1, CAST(d1 AS UNSIGNED), CAST(d2 AS UNSIGNED) FROM t1;
      

      +----------------------+----------------------+----------------------+
      | d1                   | CAST(d1 AS UNSIGNED) | CAST(d2 AS UNSIGNED) |
      +----------------------+----------------------+----------------------+
      | 18446744073709551614 |                 NULL |                    0 |
      +----------------------+----------------------+----------------------+
      

      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 (18446744073709551614,18446744073709551614);
      SELECT d1, CAST(d1 AS UNSIGNED), CAST(d2 AS UNSIGNED) FROM t1;
      

      +----------------------+----------------------+----------------------+
      | d1                   | CAST(d1 AS UNSIGNED) | CAST(d2 AS UNSIGNED) |
      +----------------------+----------------------+----------------------+
      | 18446744073709551614 | 18446744073709551614 | 18446744073709551614 |
      +----------------------+----------------------+----------------------+
      

      Note, in ColumnStore the value 18446744073709551614 is reserved for the magic value UBIGINTNULL. So perhaps in ColumnStore we'll have to return 18446744073709551613. But NULL and 0 are certainly wrong.

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              bar Alexander Barkov
              Roman Roman
              Daniel Lee Daniel Lee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.