[MCOL-4613] Garbage result of a union between huge narrow DECIMAL and BIGINT Created: 2021-03-16  Updated: 2021-06-10  Resolved: 2021-04-29

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

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

Issue Links:
Blocks
is blocked by MCOL-4612 A subquery with a union for DECIMAL a... Closed
Issue split
split to MCOL-4705 Retest MCOL-4613 in 6.1.1 given that ... 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
Sprint: 2021-7

 Description   

This ticket is for 5.6.1 only. Testing in 6.1.1 will need to wait until MCOL-4612 is MERGED into develop branch

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

+-----------------------+
| a                     |
+-----------------------+
|    9999999999999999.9 |
| -844674407370955162.6 |
+-----------------------+

Looks wrong.

Note, the problem cannot be repeated in 6.x because of MCOL-4612
But perhaps it still exists. MCOL-4612 needs to be fixed first to verify it further in 6.x.



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

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

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

The fix has some loss of precision for large values. This is because we set the union type for a BIGINT and a DECIMAL column as a DOUBLE. This limitation will be addressed in MCOL-4612 when we set the union type to a wide decimal.

Comment by Daniel Lee (Inactive) [ 2021-04-29 ]

Build verified: 5.6.1 ( Drone #2245)

Precision issue will be tracked in mentioned tickets.

MariaDB [mytest]> INSERT INTO t1 VALUES (9999999999999999.9, 999999999999999999);
Query OK, 1 row affected (0.354 sec)
 
MariaDB [mytest]> SELECT * FROM (SELECT a FROM t1 UNION SELECT b FROM t1) tu;
+----------------------+
| a                    |
+----------------------+
| 999999999999999999.0 |
|   9999999999999999.0 |
+----------------------+
2 rows in set (0.070 sec)

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