Skip to content

Commit a329f4d

Browse files
Fix(MCOL-4607): SEC_TO_TIME(wideDecimal) returns 0 in DECIMAL context (#3474)
1 parent 1bcf63a commit a329f4d

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
DROP DATABASE IF EXISTS mcol_4607;
2+
CREATE DATABASE mcol_4607;
3+
USE mcol_4607;
4+
DROP TABLE IF EXISTS t1;
5+
CREATE TABLE t1 (a DECIMAL(30,1)) ENGINE=ColumnStore;
6+
INSERT INTO t1 VALUES (1);
7+
SELECT SEC_TO_TIME(a), SEC_TO_TIME(a)+0.0 FROM t1;
8+
SEC_TO_TIME(a) SEC_TO_TIME(a)+0.0
9+
00:00:01.0 1.0
10+
DROP DATABASE mcol_4607;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--source ../include/have_columnstore.inc
2+
--disable_warnings
3+
DROP DATABASE IF EXISTS mcol_4607;
4+
--enable_warnings
5+
CREATE DATABASE mcol_4607;
6+
USE mcol_4607;
7+
8+
--disable_warnings
9+
DROP TABLE IF EXISTS t1;
10+
--enable_warnings
11+
CREATE TABLE t1 (a DECIMAL(30,1)) ENGINE=ColumnStore;
12+
INSERT INTO t1 VALUES (1);
13+
SELECT SEC_TO_TIME(a), SEC_TO_TIME(a)+0.0 FROM t1;
14+
15+
DROP DATABASE mcol_4607;

utils/funcexp/func_sec_to_time.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ execplan::IDB_Decimal Func_sec_to_time::getDecimalVal(rowgroup::Row& row, Functi
221221
tmpVal = strtoll(str, &ep, 10);
222222
}
223223

224-
if (parm[0]->data()->resultType().isWideDecimalType())
224+
if (op_ct.isWideDecimalType())
225225
d.s128Value = tmpVal;
226226
else
227227
d.value = tmpVal;

0 commit comments

Comments
 (0)