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

MCOL-392 Function fixes

Fixes most of the functions in funcexp so that time and datetime's
microseconds are handled correctly
This commit is contained in:
Andrew Hutchings
2018-04-27 21:18:14 +01:00
parent bd50bbb8bb
commit 957dc44615
11 changed files with 271 additions and 101 deletions

View File

@ -158,20 +158,21 @@ inline bool getBool(rowgroup::Row& row,
case execplan::CalpontSystemCatalog::TIME:
{
int64_t val = pm[0]->data()->getTimeIntVal(row, isNull);
// Shift out unused day for compare
int64_t val = pm[0]->data()->getTimeIntVal(row, isNull) << 12;
if (notBetween)
{
if (!numericGE(val, pm[1]->data()->getTimeIntVal(row, isNull)) && !isNull)
if (!numericGE(val, pm[1]->data()->getTimeIntVal(row, isNull) << 12) && !isNull)
return true;
isNull = false;
return (!numericLE(val, pm[2]->data()->getTimeIntVal(row, isNull)) && !isNull);
return (!numericLE(val, pm[2]->data()->getTimeIntVal(row, isNull) << 12) && !isNull);
}
return !isNull &&
numericGE(val, pm[1]->data()->getTimeIntVal(row, isNull)) &&
numericLE(val, pm[2]->data()->getTimeIntVal(row, isNull));
numericGE(val, pm[1]->data()->getTimeIntVal(row, isNull) << 12) &&
numericLE(val, pm[2]->data()->getTimeIntVal(row, isNull) << 12);
}
case execplan::CalpontSystemCatalog::DOUBLE:
@ -265,7 +266,8 @@ CalpontSystemCatalog::ColType Func_between::operationType( FunctionParm& fp, Cal
fp[i]->data()->resultType().colDataType != CalpontSystemCatalog::TEXT &&
fp[i]->data()->resultType().colDataType != CalpontSystemCatalog::VARCHAR) ||
ct.colDataType == CalpontSystemCatalog::DATE ||
ct.colDataType == CalpontSystemCatalog::DATETIME)
ct.colDataType == CalpontSystemCatalog::DATETIME ||
ct.colDataType == CalpontSystemCatalog::TIME)
{
allString = false;
}
@ -293,6 +295,23 @@ CalpontSystemCatalog::ColType Func_between::operationType( FunctionParm& fp, Cal
}
}
}
else if (op.operationType().colDataType == CalpontSystemCatalog::TIME)
{
ConstantColumn* cc = NULL;
for (uint32_t i = 1; i < fp.size(); i++)
{
cc = dynamic_cast<ConstantColumn*>(fp[i]->data());
if (cc)
{
Result result = cc->result();
result.intVal = dataconvert::DataConvert::timeToInt(result.strVal);
cc->result(result);
}
}
}
return ct;
}