[MCOL-4462] CAST(varchar_expr AS DECIMAL(M,N)) returns a wrong result Created: 2020-12-18  Updated: 2021-06-10  Resolved: 2021-03-02

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

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

Issue Links:
Blocks
is blocked by MCOL-4531 New string-to-decimal conversion impl... Closed
Relates
relates to MCOL-4500 Bit functions processing throws inter... Closed

 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(10)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES ('10.1');
SELECT
  a,
  CAST(a AS DECIMAL(10,1)),
  CAST(a AS DECIMAL(10,2)),
  CAST(a AS DECIMAL(10,3))
FROM t1;

+------+--------------------------+--------------------------+--------------------------+
| a    | CAST(a AS DECIMAL(10,1)) | CAST(a AS DECIMAL(10,2)) | CAST(a AS DECIMAL(10,3)) |
+------+--------------------------+--------------------------+--------------------------+
| 10.1 |                     10.1 |                    10.01 |                   10.001 |
+------+--------------------------+--------------------------+--------------------------+

Expected to get '10.10' and '10.100' in the third and the fourth column.


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