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

A subquery with a union for DECIMAL and BIGINT returns zeros

Details

    • 2021-8

    Description

      The problem does not seem to be repeatable in 5.x.

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(17,1), b BIGINT) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES (1, 1);
      INSERT INTO t1 VALUES (9999999999999999, 99999999999999999);
      SELECT * FROM (SELECT a FROM t1 UNION SELECT b FROM t1) tu;
      

      +------+
      | a    |
      +------+
      |  0.0 |
      |  0.0 |
      |  0.0 |
      +------+
      

      SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT b FROM t1) tu;
      

      +------+
      | a    |
      +------+
      |  0.0 |
      |  0.0 |
      |  0.0 |
      |  0.0 |
      +------+
      

      Note, without the subquery it works as expected:

      SELECT a FROM t1 UNION SELECT b FROM t1;
      

      +---------------------+
      | a                   |
      +---------------------+
      |                 1.0 |
      |  9999999999999999.0 |
      | 99999999999999999.0 |
      +---------------------+
      

      SELECT a FROM t1 UNION ALL SELECT b FROM t1;
      

      +---------------------+
      | a                   |
      +---------------------+
      |                 1.0 |
      |  9999999999999999.0 |
      |                 1.0 |
      | 99999999999999999.0 |
      +---------------------+
      

      Attachments

        Issue Links

          Activity

            For QA: Queries to confirm the issue and verify the fix works are in the issue description.

            tntnatbry Gagan Goel (Inactive) added a comment - For QA: Queries to confirm the issue and verify the fix works are in the issue description.

            Build verified: 6.1.1 (Drone #2394)

            MariaDB [mytest]> SELECT * FROM (SELECT a FROM t1 UNION SELECT b FROM t1) tu;
            +---------------------+
            | a                   |
            +---------------------+
            |                 1.0 |
            | 99999999999999999.0 |
            |  9999999999999999.0 |
            +---------------------+
            3 rows in set (0.096 sec)
             
            MariaDB [mytest]> SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT b FROM t1) tu;
            +---------------------+
            | a                   |
            +---------------------+
            |                 1.0 |
            | 99999999999999999.0 |
            |                 1.0 |
            |  9999999999999999.0 |
            +---------------------+
            4 rows in set (0.027 sec)
            

            dleeyh Daniel Lee (Inactive) added a comment - Build verified: 6.1.1 (Drone #2394) MariaDB [mytest]> SELECT * FROM (SELECT a FROM t1 UNION SELECT b FROM t1) tu; +---------------------+ | a | +---------------------+ | 1.0 | | 99999999999999999.0 | | 9999999999999999.0 | +---------------------+ 3 rows in set (0.096 sec)   MariaDB [mytest]> SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT b FROM t1) tu; +---------------------+ | a | +---------------------+ | 1.0 | | 99999999999999999.0 | | 1.0 | | 9999999999999999.0 | +---------------------+ 4 rows in set (0.027 sec)

            People

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