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

MCOL-265 Add support for TIMESTAMP data type

This commit is contained in:
Gagan Goel
2019-03-17 14:14:03 -04:00
parent 8a7ccd7d93
commit e89d1ac3cf
167 changed files with 4346 additions and 250 deletions

View File

@ -398,6 +398,10 @@ public:
{
return fResult.intVal;
}
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
{
return fResult.intVal;
}
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
{
return fResult.intVal;
@ -405,7 +409,7 @@ public:
virtual void evaluate(rowgroup::Row& row, bool& isNull) {}
inline bool getBoolVal();
inline const std::string& getStrVal();
inline const std::string& getStrVal(const std::string& timeZone);
inline int64_t getIntVal();
inline uint64_t getUintVal();
inline float getFloatVal();
@ -414,6 +418,7 @@ public:
inline IDB_Decimal getDecimalVal();
inline int32_t getDateIntVal();
inline int64_t getDatetimeIntVal();
inline int64_t getTimestampIntVal();
inline int64_t getTimeIntVal();
virtual const execplan::CalpontSystemCatalog::ColType& resultType() const
@ -506,6 +511,7 @@ inline bool TreeNode::getBoolVal()
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
return (fResult.intVal != 0);
@ -538,7 +544,7 @@ inline bool TreeNode::getBoolVal()
return fResult.boolVal;
}
inline const std::string& TreeNode::getStrVal()
inline const std::string& TreeNode::getStrVal(const std::string& timeZone)
{
switch (fResultType.colDataType)
{
@ -719,6 +725,13 @@ inline const std::string& TreeNode::getStrVal()
break;
}
case CalpontSystemCatalog::TIMESTAMP:
{
dataconvert::DataConvert::timestampToString(fResult.intVal, tmp, 255, timeZone, fResultType.precision);
fResult.strVal = std::string(tmp);
break;
}
case CalpontSystemCatalog::TIME:
{
dataconvert::DataConvert::timeToString(fResult.intVal, tmp, 255, fResultType.precision);
@ -791,6 +804,7 @@ inline int64_t TreeNode::getIntVal()
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
return fResult.intVal;
@ -837,6 +851,7 @@ inline uint64_t TreeNode::getUintVal()
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
return fResult.intVal;
@ -903,6 +918,7 @@ inline float TreeNode::getFloatVal()
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
return (float)fResult.intVal;
@ -971,6 +987,7 @@ inline double TreeNode::getDoubleVal()
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
return (double)fResult.intVal;
@ -1104,6 +1121,9 @@ inline IDB_Decimal TreeNode::getDecimalVal()
case CalpontSystemCatalog::DATETIME:
throw logging::InvalidConversionExcept("TreeNode::getDecimalVal: Invalid conversion from datetime.");
case CalpontSystemCatalog::TIMESTAMP:
throw logging::InvalidConversionExcept("TreeNode::getDecimalVal: Invalid conversion from timestamp.");
case CalpontSystemCatalog::TIME:
throw logging::InvalidConversionExcept("TreeNode::getDecimalVal: Invalid conversion from time.");
@ -1163,6 +1183,14 @@ inline int64_t TreeNode::getDatetimeIntVal()
return getIntVal();
}
inline int64_t TreeNode::getTimestampIntVal()
{
if (fResultType.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP)
return fResult.intVal;
else
return getIntVal();
}
inline int64_t TreeNode::getTimeIntVal()
{
if (fResultType.colDataType == execplan::CalpontSystemCatalog::DATETIME)