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-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:
@ -188,22 +188,7 @@ int64_t Func_cast_signed::getIntVal(Row& row,
|
||||
|
||||
if (parm[0]->data()->resultType().colWidth == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t scaleDivisor, scaleDivisor2;
|
||||
|
||||
datatypes::getScaleDivisor(scaleDivisor, d.scale);
|
||||
|
||||
scaleDivisor2 = (scaleDivisor <= 10) ? 1 : (scaleDivisor / 10);
|
||||
|
||||
int128_t tmpval = d.s128Value / scaleDivisor;
|
||||
int128_t lefto = (d.s128Value - tmpval * scaleDivisor) / scaleDivisor2;
|
||||
|
||||
if (tmpval >= 0 && lefto > 4)
|
||||
tmpval++;
|
||||
|
||||
if (tmpval < 0 && lefto < -4)
|
||||
tmpval--;
|
||||
|
||||
return datatypes::Decimal::getInt64FromWideDecimal(tmpval);
|
||||
return static_cast<int64_t>(d.getPosNegRoundedIntegralPart(4));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1206,13 +1191,7 @@ int64_t Func_cast_decimal::getIntVal(Row& row,
|
||||
|
||||
if (decimal.isTSInt128ByPrecision())
|
||||
{
|
||||
int128_t scaleDivisor;
|
||||
|
||||
datatypes::getScaleDivisor(scaleDivisor, decimal.scale);
|
||||
|
||||
int128_t tmpval = decimal.s128Value / scaleDivisor;
|
||||
|
||||
return datatypes::Decimal::getInt64FromWideDecimal(tmpval);
|
||||
return static_cast<int64_t>(decimal.getIntegralPart());
|
||||
}
|
||||
|
||||
return (int64_t) decimal.value / helpers::powerOf10_c[decimal.scale];
|
||||
|
Reference in New Issue
Block a user