You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-807 HOUR() is always positive
It is undocumented but when MariaDB gets a negative time in the HOUR() function it always returns a positive value. This does the same for us.
This commit is contained in:
@ -127,22 +127,13 @@ int64_t Func_hour::getIntVal(rowgroup::Row& row,
|
|||||||
|
|
||||||
if (isTime)
|
if (isTime)
|
||||||
{
|
{
|
||||||
// If negative, mask so it doesn't turn positive
|
// HOUR() is always positive in MariaDB, even for negative time
|
||||||
bool isNeg = false;
|
|
||||||
int64_t mask = 0;
|
int64_t mask = 0;
|
||||||
|
|
||||||
if ((val >> 40) & 0x800)
|
if ((val >> 40) & 0x800)
|
||||||
mask = 0xfffffffffffff000;
|
mask = 0xfffffffffffff000;
|
||||||
|
|
||||||
if (!mask && (val >> 63))
|
val = abs(mask | ((val >> 40) & 0xfff));
|
||||||
{
|
|
||||||
isNeg = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
val = mask | ((val >> 40) & 0xfff);
|
|
||||||
|
|
||||||
if (isNeg)
|
|
||||||
val *= -1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user