1
0
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:
Andrew Hutchings
2018-04-30 08:08:42 +01:00
parent aae2810d73
commit fc05a9c6c2
2 changed files with 16 additions and 8 deletions

View File

@ -212,16 +212,20 @@ int64_t Func_greatest::getTimeIntVal(rowgroup::Row& row,
execplan::CalpontSystemCatalog::ColType& ct) execplan::CalpontSystemCatalog::ColType& ct)
{ {
// Strip off unused day // 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++) 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; greatestStr = str1;
str = str2;
}
} }
return greatestStr; return greatestStr;

View File

@ -188,16 +188,20 @@ int64_t Func_least::getTimeIntVal(rowgroup::Row& row,
execplan::CalpontSystemCatalog::ColType& op_ct) execplan::CalpontSystemCatalog::ColType& op_ct)
{ {
// Strip off unused day // 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++) 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; leastStr = str1;
str = str2;
}
} }
return leastStr; return leastStr;