You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
MCOL-265 Add support for TIMESTAMP data type
This commit is contained in:
@@ -139,6 +139,7 @@ BulkLoadBuffer::BulkLoadBuffer(
|
||||
fEnclosedByChar('\0'), fEscapeChar('\\'),
|
||||
fBufferId(bufferId), fTableName(tableName),
|
||||
fbTruncationAsError(false), fImportDataMode(IMPORT_DATA_TEXT),
|
||||
fTimeZone("SYSTEM"),
|
||||
fFixedBinaryRecLen(0)
|
||||
{
|
||||
fData = new char[bufferSize];
|
||||
@@ -939,6 +940,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
bool bSatVal = false;
|
||||
|
||||
if ( column.dataType != CalpontSystemCatalog::DATETIME &&
|
||||
column.dataType != CalpontSystemCatalog::TIMESTAMP &&
|
||||
column.dataType != CalpontSystemCatalog::TIME )
|
||||
{
|
||||
if (nullFlag)
|
||||
@@ -1072,6 +1074,59 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
|
||||
pVal = &llDate;
|
||||
}
|
||||
else if (column.dataType == CalpontSystemCatalog::TIMESTAMP)
|
||||
{
|
||||
// timestamp conversion
|
||||
int rc = 0;
|
||||
|
||||
if (nullFlag)
|
||||
{
|
||||
if (column.fWithDefault)
|
||||
{
|
||||
llDate = column.fDefaultInt;
|
||||
// fall through to update saturation and min/max
|
||||
}
|
||||
else
|
||||
{
|
||||
llDate = joblist::TIMESTAMPNULL;
|
||||
pVal = &llDate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fImportDataMode != IMPORT_DATA_TEXT)
|
||||
{
|
||||
memcpy(&llDate, field, sizeof(llDate));
|
||||
|
||||
if (!dataconvert::DataConvert::isColumnTimeStampValid(
|
||||
llDate))
|
||||
rc = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
llDate = dataconvert::DataConvert::convertColumnTimestamp(
|
||||
field, dataconvert::CALPONTDATETIME_ENUM,
|
||||
rc, fieldLength, fTimeZone );
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -3089,6 +3144,11 @@ bool BulkLoadBuffer::isBinaryFieldNull(void* val,
|
||||
if ((*(uint64_t*)val) == joblist::DATETIMENULL)
|
||||
isNullFlag = true;
|
||||
}
|
||||
else if (dt == execplan::CalpontSystemCatalog::TIMESTAMP)
|
||||
{
|
||||
if ((*(uint64_t*)val) == joblist::TIMESTAMPNULL)
|
||||
isNullFlag = true;
|
||||
}
|
||||
else if (dt == execplan::CalpontSystemCatalog::TIME)
|
||||
{
|
||||
if ((*(uint64_t*)val) == joblist::TIMENULL)
|
||||
|
Reference in New Issue
Block a user