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

@ -902,7 +902,8 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
{
bool bSatVal = false;
if ( column.dataType != CalpontSystemCatalog::DATETIME )
if ( column.dataType != CalpontSystemCatalog::DATETIME &&
column.dataType != CalpontSystemCatalog::TIME )
{
if (nullFlag)
{
@ -976,6 +977,59 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
pVal = &llVal;
}
else if (column.dataType == CalpontSystemCatalog::TIME)
{
// time conversion
int rc = 0;
if (nullFlag)
{
if (column.fWithDefault)
{
llDate = column.fDefaultInt;
// fall through to update saturation and min/max
}
else
{
llDate = joblist::TIMENULL;
pVal = &llDate;
break;
}
}
else
{
if (fImportDataMode != IMPORT_DATA_TEXT)
{
memcpy(&llDate, field, sizeof(llDate));
if (!dataconvert::DataConvert::isColumnTimeValid(
llDate))
rc = -1;
}
else
{
llDate = dataconvert::DataConvert::convertColumnTime(
field, dataconvert::CALPONTTIME_ENUM,
rc, fieldLength );
}
}
if (rc == 0)
{
if (llDate < bufStats.minBufferVal)
bufStats.minBufferVal = llDate;
if (llDate > bufStats.maxBufferVal)
bufStats.maxBufferVal = llDate;
}
else
{
llDate = 0;
bufStats.satCount++;
}
pVal = &llDate;
}
else
{
// datetime conversion
@ -2973,6 +3027,11 @@ bool BulkLoadBuffer::isBinaryFieldNull(void* val,
if ((*(uint64_t*)val) == joblist::DATETIMENULL)
isNullFlag = true;
}
else if (dt == execplan::CalpontSystemCatalog::TIME)
{
if ((*(uint64_t*)val) == joblist::TIMENULL)
isNullFlag = true;
}
else
{
if ((*(uint64_t*)val) == joblist::BIGINTNULL)