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

MCOL-4171

This commit is contained in:
David Hall
2020-07-30 17:28:11 -05:00
committed by Roman Nozdrin
parent 5287e6860b
commit 638202417f
40 changed files with 807 additions and 250 deletions

View File

@ -196,7 +196,7 @@ public:
return TreeNode::getBoolVal();
}
void adjustResultType(const CalpontSystemCatalog::ColType& m);
constexpr inline bool getOverflowCheck() const
const inline bool getOverflowCheck() const
{
return fDecimalOverflowCheck;
}

View File

@ -503,7 +503,7 @@ bool SimpleColumn::singleTable(CalpontSystemCatalog::TableAliasName& tan)
void SimpleColumn::evaluate(Row& row, bool& isNull)
{
// WIP Move this block into an appropriate place
if (UNLIKELY(fInputOffset == -1))
if (UNLIKELY((int)(fInputOffset == (uint32_t)-1)))
{
fInputOffset = row.getOffset(fInputIndex);
}

View File

@ -52,6 +52,8 @@ using namespace rowgroup;
#include "joblisttypes.h"
using namespace joblist;
#include "widedecimalutils.h"
#ifdef _MSC_VER
#define strcasecmp stricmp
#endif
@ -387,9 +389,16 @@ void WindowFunctionColumn::adjustResultType()
boost::iequals(fFunctionName, "AVG") ||
boost::iequals(fFunctionName, "AVG_DISTINCT"))
{
fResultType.colDataType = CalpontSystemCatalog::LONGDOUBLE;
fResultType.colWidth = sizeof(long double);
fResultType.precision = -1;
if (fFunctionParms[0]->resultType().colDataType == CalpontSystemCatalog::DECIMAL)
{
fResultType.colWidth = sizeof(int128_t);
}
else
{
fResultType.colDataType = CalpontSystemCatalog::LONGDOUBLE;
fResultType.colWidth = sizeof(long double);
fResultType.precision = -1;
}
}
}
@ -661,18 +670,35 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull)
break;
}
default:
case 8:
{
if (row.equals<8>(BIGINTNULL, fInputIndex))
isNull = true;
else
{
fResult.decimalVal.value = (int64_t)row.getUintField<8>(fInputIndex);
fResult.decimalVal.value = row.getIntField<8>(fInputIndex);
fResult.decimalVal.scale = (unsigned)fResultType.scale;
}
break;
}
case 16:
{
int128_t dec = row.getInt128Field(fInputIndex);
if (utils::isWideDecimalNullValue(dec))
isNull = true;
else
{
fResult.decimalVal.s128Value = dec;
fResult.decimalVal.scale = (unsigned)fResultType.scale;
}
break;
}
default:
// Should log error
break;
}
break;