You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-392 Fix greatest() and least() for time
This commit is contained in:
@ -212,16 +212,20 @@ int64_t Func_greatest::getTimeIntVal(rowgroup::Row& row,
|
||||
execplan::CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
// Strip off unused day
|
||||
int64_t str = fp[0]->data()->getTimeIntVal(row, isNull) << 12;
|
||||
int64_t greatestStr = fp[0]->data()->getTimeIntVal(row, isNull);
|
||||
|
||||
int64_t greatestStr = str;
|
||||
int64_t str = greatestStr << 12;
|
||||
|
||||
for (uint32_t i = 1; i < fp.size(); i++)
|
||||
{
|
||||
int64_t str1 = fp[i]->data()->getTimeIntVal(row, isNull) << 12;
|
||||
int64_t str1 = fp[i]->data()->getTimeIntVal(row, isNull);
|
||||
int64_t str2 = str1 << 12;
|
||||
|
||||
if ( greatestStr < str1 )
|
||||
if ( str < str1 )
|
||||
{
|
||||
greatestStr = str1;
|
||||
str = str2;
|
||||
}
|
||||
}
|
||||
|
||||
return greatestStr;
|
||||
|
@ -188,16 +188,20 @@ int64_t Func_least::getTimeIntVal(rowgroup::Row& row,
|
||||
execplan::CalpontSystemCatalog::ColType& op_ct)
|
||||
{
|
||||
// Strip off unused day
|
||||
int64_t str = fp[0]->data()->getTimeIntVal(row, isNull) << 12;
|
||||
int64_t leastStr = fp[0]->data()->getTimeIntVal(row, isNull);
|
||||
|
||||
int64_t leastStr = str;
|
||||
int64_t str = leastStr << 12;
|
||||
|
||||
for (uint32_t i = 1; i < fp.size(); i++)
|
||||
{
|
||||
int64_t str1 = fp[i]->data()->getTimeIntVal(row, isNull) << 12;
|
||||
int64_t str1 = fp[i]->data()->getTimeIntVal(row, isNull);
|
||||
int64_t str2 = str1 << 12;
|
||||
|
||||
if ( leastStr > str1 )
|
||||
if ( str > str1 )
|
||||
{
|
||||
leastStr = str1;
|
||||
str = str2;
|
||||
}
|
||||
}
|
||||
|
||||
return leastStr;
|
||||
|
Reference in New Issue
Block a user