You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
bug(priproc) make last_day type a bit more accurate
This fixes discrepance with the server, which assigns DATE type to last_day()'s result. Now we also assigns DATE result type and, also, use proper dataconvert::Day data structure to return date. Tests agree with InnoDB. Also, this patch includes test for MCOL-5669, to show we fixed it.
This commit is contained in:
committed by
Sergey Zefirov
parent
7b0a04270f
commit
a1e64d4cb0
@ -163,6 +163,12 @@ int64_t Func_last_day::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& i
|
||||
|
||||
uint32_t lastday = day;
|
||||
|
||||
if (month < 1 || month > 12)
|
||||
{
|
||||
isNull = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (isLeapYear(year) && (month == 2))
|
||||
{
|
||||
lastday = 29;
|
||||
@ -182,16 +188,13 @@ int64_t Func_last_day::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& i
|
||||
return -1;
|
||||
}
|
||||
|
||||
dataconvert::DateTime aDay;
|
||||
dataconvert::Date aDay;
|
||||
aDay.year = year;
|
||||
aDay.month = month;
|
||||
aDay.day = lastday;
|
||||
aDay.hour = 0;
|
||||
aDay.minute = 0;
|
||||
aDay.second = 0;
|
||||
aDay.msecond = 0;
|
||||
val = *(reinterpret_cast<uint64_t*>(&aDay));
|
||||
val = *(reinterpret_cast<uint32_t*>(&aDay));
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
} // namespace funcexp
|
||||
|
Reference in New Issue
Block a user