[MCOL-4604] CHAR(negativeWideDecimal) not behaving as InnoDB Created: 2021-03-15  Updated: 2021-03-30  Resolved: 2021-03-25

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

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MCOL-4361 Replace pow(10.0, (double)scale) expr... Closed
Duplicate
is duplicated by MCOL-4634 CHAR(negativeWideDecimal) is not like... Closed
Relates
relates to MCOL-4633 Remove duplicate code for DECIMAL to ... Closed
Sprint: 2021-5

 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL(30,0)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (-1);
SELECT HEX(CHAR(a USING latin1)) FROM t1;

+---------------------------+
| HEX(CHAR(a USING latin1)) |
+---------------------------+
| NULL                      |
+---------------------------+

Looks wrong. The expected result is:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL(30,0)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1);
SELECT HEX(CHAR(a USING latin1)) FROM t1;

+---------------------------+
| HEX(CHAR(a USING latin1)) |
+---------------------------+
| FFFFFFFF                  |
+---------------------------+

Note, negative narrow decimals do not have this problem and work as expected:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL(10,0)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (-1);
SELECT HEX(CHAR(a USING latin1)) FROM t1;

+---------------------------+
| HEX(CHAR(a USING latin1)) |
+---------------------------+
| FFFFFFFF                  |
+---------------------------+


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