mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
fixed overflow check
This commit is contained in:
parent
b428f8fcd8
commit
fd1d24c928
@ -1041,7 +1041,11 @@ public:
|
||||
return ResultDataType().createColumnConst(col_left_const->size(), toField(res));
|
||||
}
|
||||
|
||||
col_res = ColVecResult::create(0, type.getScale());
|
||||
if constexpr(IsDecimalNumber<ResultType>)
|
||||
col_res = ColVecResult::create(0, type.getScale());
|
||||
else
|
||||
col_res = ColVecResult::create(0);
|
||||
|
||||
auto & vec_res = col_res->getData();
|
||||
vec_res.resize(col_left_raw->size());
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <type_traits>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
#include <Functions/FunctionBinaryArithmetic.h>
|
||||
#include <common/arithmeticOverflow.h>
|
||||
@ -29,7 +30,12 @@ struct MultiplyImpl
|
||||
template <typename Result = ResultType>
|
||||
static inline bool apply(A a, B b, Result & c)
|
||||
{
|
||||
return common::mulOverflow(static_cast<Result>(a), b, c);
|
||||
if constexpr(std::is_same_v<Result, float> || std::is_same_v<Result, double>)
|
||||
{
|
||||
c = static_cast<Result>(a) * b;
|
||||
return false;
|
||||
} else
|
||||
return common::mulOverflow(static_cast<Result>(a), b, c);
|
||||
}
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
|
Loading…
Reference in New Issue
Block a user