mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Minor change
This commit is contained in:
parent
39515083e4
commit
cae9b25074
@ -269,12 +269,6 @@ public:
|
||||
void operator() (const AggregateFunctionStateData & x) const;
|
||||
};
|
||||
|
||||
template <typename T> constexpr bool isDecimalField() { return false; }
|
||||
template <> constexpr bool isDecimalField<DecimalField<Decimal32>>() { return true; }
|
||||
template <> constexpr bool isDecimalField<DecimalField<Decimal64>>() { return true; }
|
||||
template <> constexpr bool isDecimalField<DecimalField<Decimal128>>() { return true; }
|
||||
template <> constexpr bool isDecimalField<DecimalField<Decimal256>>() { return true; }
|
||||
|
||||
|
||||
/** Implements `+=` operation.
|
||||
* Returns false if the result is zero.
|
||||
|
@ -37,13 +37,13 @@ public:
|
||||
return accurate::equalsOp(l, r);
|
||||
|
||||
/// TODO This is wrong (does not respect scale).
|
||||
if constexpr (isDecimalField<T>() && isDecimalField<U>())
|
||||
if constexpr (is_decimal_field<T> && is_decimal_field<U>)
|
||||
return l == r;
|
||||
|
||||
if constexpr (isDecimalField<T>() && std::is_arithmetic_v<U>)
|
||||
if constexpr (is_decimal_field<T> && std::is_arithmetic_v<U>)
|
||||
return l == DecimalField<Decimal256>(Decimal256(r), 0);
|
||||
|
||||
if constexpr (std::is_arithmetic_v<T> && isDecimalField<U>())
|
||||
if constexpr (std::is_arithmetic_v<T> && is_decimal_field<U>)
|
||||
return DecimalField<Decimal256>(Decimal256(l), 0) == r;
|
||||
|
||||
if constexpr (std::is_same_v<T, String> && std::is_arithmetic_v<U>)
|
||||
@ -86,13 +86,13 @@ public:
|
||||
return accurate::lessOp(l, r);
|
||||
|
||||
/// TODO This is wrong (does not respect scale).
|
||||
if constexpr (isDecimalField<T>() && isDecimalField<U>())
|
||||
if constexpr (is_decimal_field<T> && is_decimal_field<U>)
|
||||
return l < r;
|
||||
|
||||
if constexpr (isDecimalField<T>() && std::is_arithmetic_v<U>)
|
||||
if constexpr (is_decimal_field<T> && std::is_arithmetic_v<U>)
|
||||
return l < DecimalField<Decimal256>(Decimal256(r), 0);
|
||||
|
||||
if constexpr (std::is_arithmetic_v<T> && isDecimalField<U>())
|
||||
if constexpr (std::is_arithmetic_v<T> && is_decimal_field<U>)
|
||||
return DecimalField<Decimal256>(Decimal256(l), 0) < r;
|
||||
|
||||
if constexpr (std::is_same_v<T, String> && std::is_arithmetic_v<U>)
|
||||
|
@ -162,6 +162,12 @@ private:
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
template <typename T> constexpr bool is_decimal_field = false;
|
||||
template <> constexpr bool is_decimal_field<DecimalField<Decimal32>> = true;
|
||||
template <> constexpr bool is_decimal_field<DecimalField<Decimal64>> = true;
|
||||
template <> constexpr bool is_decimal_field<DecimalField<Decimal128>> = true;
|
||||
template <> constexpr bool is_decimal_field<DecimalField<Decimal256>> = true;
|
||||
|
||||
/// char may be signed or unsigned, and behave identically to signed char or unsigned char,
|
||||
/// but they are always three different types.
|
||||
/// signedness of char is different in Linux on x86 and Linux on ARM.
|
||||
|
@ -252,7 +252,7 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
|
||||
NO_SANITIZE_UNDEFINED
|
||||
{
|
||||
using ValueType = std::decay_t<decltype(value)>;
|
||||
if constexpr (isDecimalField<ValueType>())
|
||||
if constexpr (is_decimal_field<ValueType>)
|
||||
{
|
||||
// The parser doesn't create decimal literals, but
|
||||
// they can be produced by constant folding or the
|
||||
|
Loading…
Reference in New Issue
Block a user