1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-4743 Regression: TIME_TO_SEC(const_expr) erroneosly returns 0

This commit is contained in:
Alexander Barkov
2021-06-02 15:08:20 +04:00
parent 8a68adcac4
commit d61690748e
5 changed files with 27 additions and 5 deletions

View File

@ -192,9 +192,7 @@ ConstantColumn::ConstantColumn(const string& sql, const IDB_Decimal& val) :
fResult.longDoubleVal = strtold(sql.c_str(), NULL); fResult.longDoubleVal = strtold(sql.c_str(), NULL);
fResult.decimalVal = val; fResult.decimalVal = val;
fResultType.colDataType = CalpontSystemCatalog::DECIMAL; fResultType.colDataType = CalpontSystemCatalog::DECIMAL;
fResultType.colWidth = 8; fResultType.setDecimalScalePrecision(val.precision, val.scale);
fResultType.scale = val.scale;
fResultType.precision = val.precision;
} }
ConstantColumn::ConstantColumn( const ConstantColumn& rhs): ConstantColumn::ConstantColumn( const ConstantColumn& rhs):

View File

@ -238,7 +238,10 @@ void TupleConstantStep::constructContanstRow(const JobInfo& jobInfo)
case CalpontSystemCatalog::DECIMAL: case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL: case CalpontSystemCatalog::UDECIMAL:
{ {
fRowConst.setIntField(c.decimalVal.value, *i); if (fRowGroupOut.getColWidths()[*i] > datatypes::MAXLEGACYWIDTH)
fRowConst.setInt128Field(c.decimalVal.TSInt128::getValue(), *i);
else
fRowConst.setIntField(c.decimalVal.value, *i);
break; break;
} }

View File

@ -1,4 +1,3 @@
mcs80_set_operations : BUG#MCOL-4273 2020-08-27 susil.behera@mariadb.com mcs80_set_operations : BUG#MCOL-4273 2020-08-27 susil.behera@mariadb.com
mcs251_time_to_sec_function : BUG#MCOL-4414 2020-11-30 bharath.bokka@maridb.com
mcs212_idbExtentMax_function : 2020-11-30 bharath.bokka@mariadb.com mcs212_idbExtentMax_function : 2020-11-30 bharath.bokka@mariadb.com
mcs213_idbExtentMin_function : 2020-11-30 bharath.bokka@mariadb.com mcs213_idbExtentMin_function : 2020-11-30 bharath.bokka@mariadb.com

View File

@ -29,4 +29,14 @@ t1_DATETIME TIME_TO_SEC(t1_DATETIME)
1997-12-12 22:12:02 79922 1997-12-12 22:12:02 79922
2001-01-01 23:59:59 86399 2001-01-01 23:59:59 86399
2009-12-11 01:08:59 4139 2009-12-11 01:08:59 4139
DROP TABLE t1;
#
# MCOL-4743 Regression: TIME_TO_SEC(const_expr) erroneosly returns 0
#
CREATE TABLE t1 (a INT) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (1);
SELECT TIME_TO_SEC('10:50:40.9999') FROM t1;
TIME_TO_SEC('10:50:40.9999')
39040.9999
DROP TABLE t1;
DROP DATABASE mcs251_db; DROP DATABASE mcs251_db;

View File

@ -28,5 +28,17 @@ SELECT TIME_TO_SEC('10:50:40.9999') FROM t1 LIMIT 1;
SELECT t1_TIME, TIME_TO_SEC(t1_TIME) FROM t1 ORDER BY 1; SELECT t1_TIME, TIME_TO_SEC(t1_TIME) FROM t1 ORDER BY 1;
SELECT t1_DATETIME, TIME_TO_SEC(t1_DATETIME) FROM t1 ORDER BY 1; SELECT t1_DATETIME, TIME_TO_SEC(t1_DATETIME) FROM t1 ORDER BY 1;
DROP TABLE t1;
--echo #
--echo # MCOL-4743 Regression: TIME_TO_SEC(const_expr) erroneosly returns 0
--echo #
CREATE TABLE t1 (a INT) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (1);
SELECT TIME_TO_SEC('10:50:40.9999') FROM t1;
DROP TABLE t1;
# Clean UP # Clean UP
DROP DATABASE mcs251_db; DROP DATABASE mcs251_db;