1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-392 Fix saturation handling

This commit is contained in:
Andrew Hutchings
2018-04-26 17:48:16 +01:00
parent dba04e8b72
commit bd50bbb8bb
2 changed files with 41 additions and 2 deletions

View File

@ -997,8 +997,27 @@ bool mysql_str_to_time( const string& input, Time& output )
}
if ( !isTimeValid( hour, min, sec, usec ) )
{
// Emulate MariaDB's time saturation
if (hour > 838)
{
output.hour = 838;
output.minute = 59;
output.second = 59;
output.msecond = 999999;
}
else if (hour < -838)
{
output.hour = -838;
output.minute = 59;
output.second = 59;
output.msecond = 999999;
}
// If neither of the above match then we return a 0 time
else
{
output.reset();
}
return false;
}
@ -1967,6 +1986,27 @@ int64_t DataConvert::convertColumnTime(
}
else
{
// Emulate MariaDB's time saturation
if (inHour > 838)
{
Time atime;
atime.hour = 838;
atime.minute = 59;
atime.second = 59;
atime.msecond = 999999;
memcpy( &value, &atime, 8);
}
else if (inHour < -838)
{
Time atime;
atime.hour = -838;
atime.minute = 59;
atime.second = 59;
atime.msecond = 999999;
memcpy( &value, &atime, 8);
}
// If neither of the above match then we return a 0 time
status = -1;
}

View File

@ -1024,7 +1024,6 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
}
else
{
llDate = 0;
bufStats.satCount++;
}