mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Suppress UBSan report in Decimal comparison
This commit is contained in:
parent
54554247bf
commit
1546f5bcb9
@ -156,4 +156,11 @@ namespace common
|
||||
return false;
|
||||
return (x * y) / y != x;
|
||||
}
|
||||
|
||||
/// Multiply and ignore overflow.
|
||||
template <typename T1, typename T2>
|
||||
inline auto NO_SANITIZE_UNDEFINED mulIgnoreOverflow(T1 x, T2 y)
|
||||
{
|
||||
return x * y;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace ErrorCodes
|
||||
extern const int DECIMAL_OVERFLOW;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
inline bool allowDecimalComparison(const DataTypePtr & left_type, const DataTypePtr & right_type)
|
||||
{
|
||||
if (isColumnedAsDecimal(left_type))
|
||||
@ -30,7 +30,9 @@ inline bool allowDecimalComparison(const DataTypePtr & left_type, const DataType
|
||||
return true;
|
||||
}
|
||||
else if (isNotDecimalButComparableToDecimal(left_type) && isColumnedAsDecimal(right_type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -252,9 +254,9 @@ private:
|
||||
else
|
||||
{
|
||||
if constexpr (scale_left)
|
||||
x *= scale;
|
||||
x = common::mulIgnoreOverflow(x, scale);
|
||||
if constexpr (scale_right)
|
||||
y *= scale;
|
||||
y = common::mulIgnoreOverflow(y, scale);
|
||||
}
|
||||
|
||||
return Op::apply(x, y);
|
||||
|
@ -0,0 +1 @@
|
||||
0
|
@ -0,0 +1,2 @@
|
||||
SET decimal_check_overflow = 0;
|
||||
SELECT toDecimal64(0, 8) = 9223372036854775807;
|
Loading…
Reference in New Issue
Block a user