[MCOL-4653] CEIL(negativeNarrowDecimal) inside another function returns a wrong result Created: 2021-03-31  Updated: 2021-04-01  Resolved: 2021-04-01

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

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Gagan Goel (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MCOL-4361 Replace pow(10.0, (double)scale) expr... Closed
Relates
relates to MCOL-4618 FLOOR(-9999.0) returns a bad result Closed

 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (-1.6);
SELECT CEIL(a), LEFT('abc', CEIL(a)) FROM t1;

+---------+----------------------+
| CEIL(a) | LEFT('abc', CEIL(a)) |
+---------+----------------------+
|      -1 | abc                  |
+---------+----------------------+

Looks wrong. The expected result is:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL(10,1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1.6);
SELECT CEIL(a), LEFT('abc', CEIL(a)) FROM t1;

+---------+----------------------+
| CEIL(a) | LEFT('abc', CEIL(a)) |
+---------+----------------------+
|      -1 |                      |
+---------+----------------------+


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