1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-392 Fix negative time handling

This commit is contained in:
Andrew Hutchings
2018-04-26 14:28:17 +01:00
parent 3c1ebd8b94
commit edb2e2f36d
4 changed files with 44 additions and 9 deletions

View File

@ -1541,7 +1541,15 @@ void RowAggregation::doBitOp(const Row& rowIn, int64_t colIn, int64_t colOut, in
case execplan::CalpontSystemCatalog::TIME:
{
int64_t dtm = rowIn.getUintField(colIn);
valIn = (((dtm >> 40) & 0xfff) * 10000000000) +
// Handle negative correctly
int hour = 0;
if ((dtm >> 40) & 0xf00)
{
hour = 0xfffff000;
}
hour |= ((dtm >> 40) & 0xfff);
valIn = (hour * 10000000000) +
(((dtm >> 32) & 0xff) * 100000000) + (((dtm >> 24) & 0xff) * 1000000) + (dtm & 0xffffff);
break;
}