[MCOL-4612] A subquery with a union for DECIMAL and BIGINT returns zeros Created: 2021-03-16  Updated: 2021-05-24  Resolved: 2021-05-24

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr, PrimProc
Affects Version/s: 6.1.1
Fix Version/s: 6.1.1

Type: Bug Priority: Blocker
Reporter: Alexander Barkov Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: transient_regression

Issue Links:
Blocks
blocks MCOL-4613 Garbage result of a union between hug... Closed
Relates
relates to MCOL-4361 Replace pow(10.0, (double)scale) expr... Closed
relates to MCOL-641 Full DECIMAL support in ColumnStore Closed
relates to MCOL-4700 Wrong result of a UNION for INT and I... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MCOL-4706 Additional test needed Sub-Task Closed Daniel Lee  
Sprint: 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 |
+---------------------+



 Comments   
Comment by Gagan Goel (Inactive) [ 2021-04-29 ]

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

Comment by Daniel Lee (Inactive) [ 2021-05-24 ]

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)

Generated at Thu Feb 08 02:51:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.