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-392 Fix cpimport and >8bit positive hour
This commit is contained in:
@@ -1886,11 +1886,11 @@ int64_t DataConvert::convertColumnTime(
|
||||
unsigned int dataOrgLen )
|
||||
{
|
||||
status = 0;
|
||||
const char* p;
|
||||
p = dataOrg;
|
||||
char fld[10];
|
||||
int16_t value = 0;
|
||||
int inYear, inMonth, inDay, inHour, inMinute, inSecond, inMicrosecond;
|
||||
char* p;
|
||||
char* savePoint = NULL;
|
||||
p = const_cast<char*>(dataOrg);
|
||||
int64_t value = 0;
|
||||
int inHour, inMinute, inSecond, inMicrosecond;
|
||||
inHour = 0;
|
||||
inMinute = 0;
|
||||
inSecond = 0;
|
||||
@@ -1901,44 +1901,59 @@ int64_t DataConvert::convertColumnTime(
|
||||
return value;
|
||||
}
|
||||
|
||||
memcpy( fld, p, 2);
|
||||
fld[2] = '\0';
|
||||
errno = 0;
|
||||
|
||||
inHour = strtol(fld, 0, 10);
|
||||
p = strtok_r(p, ":.", &savePoint);
|
||||
inHour = strtol(p, 0, 10);
|
||||
|
||||
if (!isdigit(p[2]) || !isdigit(p[3]))
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
if (errno)
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
memcpy( fld, p + 2, 2);
|
||||
fld[2] = '\0';
|
||||
p = strtok_r(NULL, ":.", &savePoint);
|
||||
if (p == NULL)
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
inMinute = strtol(fld, 0, 10);
|
||||
inMinute = strtol(p, 0, 10);
|
||||
|
||||
if (!isdigit(p[4]) || !isdigit(p[5]))
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
if (errno)
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
memcpy( fld, p + 4, 2);
|
||||
fld[2] = '\0';
|
||||
p = strtok_r(NULL, ":.", &savePoint);
|
||||
|
||||
inSecond = strtol(fld, 0, 10);
|
||||
if (p == NULL)
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
if (dataOrgLen > 9)
|
||||
{
|
||||
unsigned int microFldLen = dataOrgLen - 9;
|
||||
inSecond = strtol(p, 0, 10);
|
||||
|
||||
if (microFldLen > (sizeof(fld) - 1))
|
||||
microFldLen = sizeof(fld) - 1;
|
||||
if (errno)
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
memcpy( fld, p + 9, microFldLen);
|
||||
fld[microFldLen] = '\0';
|
||||
inMicrosecond = strtol(fld, 0, 10);
|
||||
}
|
||||
p = strtok_r(NULL, ":.", &savePoint);
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
inMicrosecond = strtol(p, 0, 10);
|
||||
if (errno)
|
||||
{
|
||||
status = -1;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isTimeValid (inHour, inMinute, inSecond, inMicrosecond) )
|
||||
{
|
||||
|
@@ -568,7 +568,7 @@ inline void DataConvert::timeToString( long long timevalue, char* buf, unsigned
|
||||
{
|
||||
// Handle negative correctly
|
||||
int hour = 0;
|
||||
if ((timevalue >> 40) & 0xf00)
|
||||
if ((timevalue >> 40) & 0x800)
|
||||
{
|
||||
hour = 0xfffff000;
|
||||
}
|
||||
|
@@ -166,7 +166,7 @@ int64_t Func_bitand::getIntVal(Row& row,
|
||||
sec = 0,
|
||||
msec = 0;
|
||||
// Handle negative correctly
|
||||
if ((time >> 40) & 0xf00)
|
||||
if ((time >> 40) & 0x800)
|
||||
{
|
||||
hour = 0xfffff000;
|
||||
}
|
||||
|
@@ -1543,7 +1543,7 @@ void RowAggregation::doBitOp(const Row& rowIn, int64_t colIn, int64_t colOut, in
|
||||
int64_t dtm = rowIn.getUintField(colIn);
|
||||
// Handle negative correctly
|
||||
int hour = 0;
|
||||
if ((dtm >> 40) & 0xf00)
|
||||
if ((dtm >> 40) & 0x800)
|
||||
{
|
||||
hour = 0xfffff000;
|
||||
}
|
||||
|
@@ -161,7 +161,8 @@ const char ColDataTypeStr[execplan::CalpontSystemCatalog::NUM_OF_COL_DATA_TYPE]
|
||||
"unsigned-float",
|
||||
"unsigned-bigint",
|
||||
"unsigned-double",
|
||||
"text"
|
||||
"text",
|
||||
"time"
|
||||
};
|
||||
|
||||
enum FuncType { FUNC_WRITE_ENGINE, FUNC_INDEX, FUNC_DICTIONARY };
|
||||
|
Reference in New Issue
Block a user