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

MCOL-392 Add initial TIME datatype support

This commit is contained in:
Andrew Hutchings
2018-04-23 19:20:31 +01:00
parent b584a7f555
commit 3c1ebd8b94
109 changed files with 2241 additions and 47 deletions

View File

@ -473,7 +473,8 @@ void TupleUnion::normalize(const Row& in, Row* out)
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
throw logic_error("TupleUnion::normalize(): tried to normalize an int to a date or datetime");
case CalpontSystemCatalog::TIME:
throw logic_error("TupleUnion::normalize(): tried to normalize an int to a time, date or datetime");
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
@ -582,7 +583,8 @@ dec1:
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
throw logic_error("TupleUnion::normalize(): tried to normalize an int to a date or datetime");
case CalpontSystemCatalog::TIME:
throw logic_error("TupleUnion::normalize(): tried to normalize an int to a time, date or datetime");
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
@ -736,6 +738,33 @@ dec2:
break;
case CalpontSystemCatalog::TIME:
switch (out->getColTypes()[i])
{
case CalpontSystemCatalog::TIME:
out->setIntField(in.getIntField(i), i);
break;
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR:
{
string d = DataConvert::timeToString(in.getIntField(i));
out->setStringField(d, i);
break;
}
default:
{
ostringstream os;
os << "TupleUnion::normalize(): tried an illegal conversion: time to "
<< out->getColTypes()[i];
throw logic_error(os.str());
}
}
break;
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
case CalpontSystemCatalog::DOUBLE:
@ -1069,6 +1098,10 @@ void TupleUnion::writeNull(Row* out, uint32_t col)
out->setUintField<8>(joblist::DATETIMENULL, col);
break;
case CalpontSystemCatalog::TIME:
out->setUintField<8>(joblist::TIMENULL, col);
break;
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR: