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
MCOL-4409 Moved static Decimal conversion methods into VDecimal class
MCOL-4409 This patch combines VDecimal and Decimal and makes IDB_Decimal an alias for the result class MCOL-4409 More boilerplate reduction in Func_mod Removed couple TSInt128::toType() methods
This commit is contained in:
@ -99,17 +99,7 @@ int64_t Func_ceil::getIntVal(Row& row,
|
||||
|
||||
if (op_ct.colWidth == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t tmp = d.s128Value;
|
||||
int128_t scaleDivisor;
|
||||
datatypes::getScaleDivisor(scaleDivisor, d.scale);
|
||||
d.s128Value /= scaleDivisor;
|
||||
|
||||
// Add 1 if this is a positive number and there were values to the right of the
|
||||
// decimal point so that we return the largest integer value not less than X.
|
||||
if ((tmp - (d.s128Value * scaleDivisor)) > 0)
|
||||
d.s128Value += 1;
|
||||
|
||||
ret = datatypes::Decimal::getInt64FromWideDecimal(d.s128Value);
|
||||
ret = static_cast<int64_t>(d.getRoundedIntegralPart());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -252,17 +242,7 @@ uint64_t Func_ceil::getUintVal(Row& row,
|
||||
|
||||
if (op_ct.colWidth == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t tmp = d.s128Value;
|
||||
int128_t scaleDivisor;
|
||||
datatypes::getScaleDivisor(scaleDivisor, d.scale);
|
||||
d.s128Value /= scaleDivisor;
|
||||
|
||||
// Add 1 if this is a positive number and there were values to the right of the
|
||||
// decimal point so that we return the largest integer value not less than X.
|
||||
if ((tmp - (d.s128Value * scaleDivisor)) > 0)
|
||||
d.s128Value += 1;
|
||||
|
||||
ret = datatypes::Decimal::getUInt64FromWideDecimal(d.s128Value);
|
||||
ret = static_cast<uint64_t>(d.getRoundedIntegralPart());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -548,6 +528,8 @@ IDB_Decimal Func_ceil::getDecimalVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& op_ct)
|
||||
{
|
||||
// Questionable approach. I believe we should use pointer here
|
||||
// and call an appropriate ctor
|
||||
IDB_Decimal ret;
|
||||
|
||||
switch (op_ct.colDataType)
|
||||
@ -583,15 +565,9 @@ IDB_Decimal Func_ceil::getDecimalVal(Row& row,
|
||||
|
||||
if (op_ct.colWidth == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t tmp = ret.s128Value;
|
||||
int128_t scaleDivisor;
|
||||
datatypes::getScaleDivisor(scaleDivisor, ret.scale);
|
||||
ret.s128Value /= scaleDivisor;
|
||||
|
||||
// Add 1 if this is a positive number and there were values to the right of the
|
||||
// decimal point so that we return the largest integer value not less than X.
|
||||
if ((tmp - (ret.s128Value * scaleDivisor)) > 0)
|
||||
ret.s128Value += 1;
|
||||
ret = IDB_Decimal(ret.getRoundedIntegralPart(),
|
||||
ret.scale,
|
||||
ret.precision);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user