1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge pull request #21 from mariadb-corporation/MCOL-329

MCOL-329
This commit is contained in:
dhall-InfiniDB
2016-09-27 14:37:51 -05:00
committed by GitHub
4 changed files with 43 additions and 28 deletions

View File

@ -510,20 +510,12 @@ int32_t Func_cast_date::getDateIntVal(rowgroup::Row& row,
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
if (parm[0]->data()->resultType().scale != 0)
{
val = dataconvert::DataConvert::intToDate(parm[0]->data()->getIntVal(row, isNull));
if (val == -1)
isNull = true;
break;
}
else
{
val = dataconvert::DataConvert::intToDate(parm[0]->data()->getIntVal(row, isNull));
if (val == -1)
isNull = true;
else
return val;
break;
}
return val;
break;
}
case execplan::CalpontSystemCatalog::VARCHAR:
case execplan::CalpontSystemCatalog::CHAR:
@ -715,18 +707,11 @@ int64_t Func_cast_datetime::getDatetimeIntVal(rowgroup::Row& row,
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
if (parm[0]->data()->resultType().scale)
{
val = dataconvert::DataConvert::intToDatetime(parm[0]->data()->getIntVal(row, isNull));
if (val == -1)
isNull = true;
else
return val;
}
else
{
val = dataconvert::DataConvert::intToDatetime(parm[0]->data()->getIntVal(row, isNull));
if (val == -1)
isNull = true;
}
else
return val;
break;
}
case execplan::CalpontSystemCatalog::VARCHAR:

View File

@ -78,8 +78,15 @@ uint64_t makedate(rowgroup::Row& row,
isNull = true;
return 0;
}
if (year < 1000 || year > 9999) {
if (year < 70)
{
year = 2000 + year;
}
else if (year < 100)
{
year = 1900 + year;
}
else if (year < 1000 || year > 9999) {
isNull = true;
return 0;
}

View File

@ -75,6 +75,8 @@ int64_t Func_year::getIntVal(rowgroup::Row& row,
case CalpontSystemCatalog::SMALLINT:
case CalpontSystemCatalog::TINYINT:
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::DOUBLE:
val = dataconvert::DataConvert::intToDatetime(parm[0]->data()->getIntVal(row, isNull));
if (val == -1)
{
@ -85,7 +87,7 @@ int64_t Func_year::getIntVal(rowgroup::Row& row,
{
return (unsigned)((val >> 48) & 0xffff);
}
break;
break;
case CalpontSystemCatalog::DECIMAL:
if (parm[0]->data()->resultType().scale == 0)
{