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

MCOL-4188 Regression fixes for MCOL-641.

1. Add wide decimal support to AggregateColumn::evaluate
and TreeNode::getDecimalVal().
2. Use the pm aggregate attributes to determine um aggregate
attributes in TupleAggregateStep::prep2PhasesAggregate.
This commit is contained in:
Gagan Goel
2020-11-19 18:56:40 -05:00
parent aa64d81cde
commit a159f8a0b6
8 changed files with 125 additions and 44 deletions

View File

@ -230,6 +230,16 @@ public:
}
}
/**
@brief The method returns true if the column precision
belongs to a wide decimal range.
*/
inline bool isWideDecimalPrecision() const
{
return ((precision > INT64MAXPRECISION) &&
(precision <= INT128MAXPRECISION));
}
};
class TypeHolderStd: public TypeAttributesStd

View File

@ -172,6 +172,8 @@ class Decimal: public TSInt128
public:
static constexpr uint8_t MAXLENGTH16BYTES = TSInt128::maxLength();
static constexpr uint8_t MAXLENGTH8BYTES = 23;
static constexpr int128_t minInt128 = TFloat128::minInt128;
static constexpr int128_t maxInt128 = TFloat128::maxInt128;
static inline bool isWideDecimalNullValue(const int128_t& val)
{
@ -193,9 +195,6 @@ class Decimal: public TSInt128
val = TSInt128::EmptyValue;
}
static constexpr int128_t minInt128 = int128_t(0x8000000000000000LL) << 64;
static constexpr int128_t maxInt128 = (int128_t(0x7FFFFFFFFFFFFFFFLL) << 64) + 0xFFFFFFFFFFFFFFFFLL;
/**
@brief Compares two Decimal taking scale into account.
*/

View File

@ -50,6 +50,9 @@ struct get_integral_type<TSInt128>{
class TFloat128
{
public:
static constexpr int128_t minInt128 = int128_t(0x8000000000000000LL) << 64;
static constexpr int128_t maxInt128 = (int128_t(0x7FFFFFFFFFFFFFFFLL) << 64) + 0xFFFFFFFFFFFFFFFFLL;
static constexpr uint16_t MAXLENGTH16BYTES = 42;
// A variety of ctors for aligned and unaligned arguments
TFloat128(): value(0) { }
@ -64,7 +67,21 @@ class TFloat128
return TFloat128::MAXLENGTH16BYTES;
}
// The method converts a TFloat128 to integral types
inline int128_t toTSInt128() const
{
if (value > static_cast<__float128>(maxInt128))
return maxInt128;
else if (value < static_cast<__float128>(minInt128))
return minInt128;
return static_cast<int128_t>(value);
}
inline operator int128_t() const
{
return toTSInt128();
}
inline operator double() const
{
return toDouble();
@ -100,7 +117,7 @@ class TFloat128
return toTSInt64();
}
inline int64_t toTUInt64() const
inline uint64_t toTUInt64() const
{
if (value > static_cast<__float128>(UINT64_MAX))
return UINT64_MAX;

View File

@ -119,10 +119,12 @@ class TSInt128
static constexpr int128_t NullValue = int128_t(0x8000000000000000LL) << 64;
static constexpr int128_t EmptyValue = (int128_t(0x8000000000000000LL) << 64) + 1;
// A variety of ctors for aligned and unaligned arguments
TSInt128(): s128Value(0) { }
// Copy ctor
TSInt128(const TSInt128& other): s128Value(other.s128Value) { }
// aligned argument
TSInt128(const int128_t& x) { s128Value = x; }