1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-641 Addition now works for DECIMAL columns with precision > 18.

This commit is contained in:
drrtuy
2020-01-26 11:07:45 +03:00
committed by Roman Nozdrin
parent 54c152d6c8
commit 98213c0094
11 changed files with 175 additions and 14 deletions

View File

@ -51,6 +51,7 @@ using namespace joblist;
#include "aggregatecolumn.h"
#include "constantfilter.h"
#include "../../utils/windowfunction/windowfunction.h"
#include "utils/common/branchpred.h"
namespace execplan
{
@ -482,6 +483,7 @@ void SimpleColumn::setDerivedTable()
// @todo make aggregate filter to having clause. not optimize it for now
if (fDerivedRefCol &&
// WIP replace with typeid()
(dynamic_cast<AggregateColumn*>(fDerivedRefCol) ||
dynamic_cast<WindowFunctionColumn*>(fDerivedRefCol)))
fDerivedTable = "";
@ -500,6 +502,12 @@ bool SimpleColumn::singleTable(CalpontSystemCatalog::TableAliasName& tan)
// @todo move to inline
void SimpleColumn::evaluate(Row& row, bool& isNull)
{
// WIP Move this block into an appropriate place
if (UNLIKELY(fInputOffset == -1))
{
fInputOffset = row.getOffset(fInputIndex);
}
bool isNull2 = row.isNullValue(fInputIndex);
if (isNull2)
@ -627,7 +635,16 @@ void SimpleColumn::evaluate(Row& row, bool& isNull)
{
case 16:
{
fResult.decimalVal.value = row.getIntField<16>(fInputIndex);
if (fResultType.colDataType == CalpontSystemCatalog::UDECIMAL)
{
fResult.decimalVal.__v.__u128 =
*row.getBinaryField_offset<decltype(fResult.decimalVal.__v.__u128)>(fInputOffset);
}
else
{
fResult.decimalVal.__v.__s128 =
*row.getBinaryField_offset<decltype(fResult.decimalVal.__v.__s128)>(fInputOffset);
}
fResult.decimalVal.scale = (unsigned)fResultType.scale;
break;
}