Skip to content

Commit 8ed8057

Browse files
AestheticAkhmaddrrtuy
authored andcommitted
Perform conversion to DECIMAL if constant column has scale > 0
1 parent d635b9b commit 8ed8057

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

dbcon/joblist/jlf_execplantojoblist.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,11 +1743,18 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo)
17431743

17441744
#else
17451745
bool isNull = cc->isNull();
1746-
17471746
if (ct.isWideDecimalType())
1747+
{
17481748
convertValueNum(constval.safeString(""), ct, isNull, rf, jobInfo.timeZone, value128);
1749+
}
1750+
else if (cc->resultType().colDataType == CalpontSystemCatalog::DECIMAL && cc->resultType().scale > 0)
1751+
{
1752+
convertValueNum(constval.safeString(""), cc->resultType(), isNull, rf, jobInfo.timeZone, value);
1753+
}
17491754
else
1755+
{
17501756
convertValueNum(constval.safeString(""), ct, isNull, rf, jobInfo.timeZone, value);
1757+
}
17511758

17521759
if (ct.colDataType == CalpontSystemCatalog::FLOAT && !isNull)
17531760
{

mysql-test/columnstore/bugfixes/mcol_4628.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,16 @@ UPDATE t1 SET i=d;
5050
SELECT * FROM t1;
5151
i d
5252
1 1.4
53+
DROP TABLE IF EXISTS t1;
54+
CREATE TABLE t1 (i SMALLINT) ENGINE=ColumnStore;
55+
INSERT INTO t1 VALUES (-762);
56+
INSERT INTO t1 VALUES (-761);
57+
INSERT INTO t1 VALUES (761);
58+
INSERT INTO t1 VALUES (762);
59+
SELECT * FROM t1 WHERE i > -762.5;
60+
i
61+
-762
62+
-761
63+
761
64+
762
5365
DROP DATABASE mcol_4628;

mysql-test/columnstore/bugfixes/mcol_4628.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ INSERT INTO t1 VALUES (0, 1.4);
6161
UPDATE t1 SET i=d;
6262
SELECT * FROM t1;
6363

64+
--disable_warnings
65+
DROP TABLE IF EXISTS t1;
66+
--enable_warnings
67+
CREATE TABLE t1 (i SMALLINT) ENGINE=ColumnStore;
68+
INSERT INTO t1 VALUES (-762);
69+
INSERT INTO t1 VALUES (-761);
70+
INSERT INTO t1 VALUES (761);
71+
INSERT INTO t1 VALUES (762);
72+
SELECT * FROM t1 WHERE i > -762.5;
73+
6474
--disable_warnings
6575
DROP DATABASE mcol_4628;
6676
--enable_warnings

0 commit comments

Comments
 (0)