mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Arithmetic
This commit is contained in:
parent
1c85a0401f
commit
bf8fc60bac
@ -804,7 +804,7 @@ class FunctionBinaryArithmetic : public IFunction
|
||||
DataTypeFixedString, DataTypeString,
|
||||
DataTypeInterval>;
|
||||
|
||||
using Floats = TypeList<DataTypeFloat32, DataTypeFloat64>;
|
||||
using Floats = TypeList<DataTypeFloat32, DataTypeFloat64, DataTypeBFloat16>;
|
||||
|
||||
using ValidTypes = std::conditional_t<valid_on_float_arguments,
|
||||
TypeListConcat<Types, Floats>,
|
||||
@ -2043,7 +2043,15 @@ ColumnPtr executeStringInteger(const ColumnsWithTypeAndName & arguments, const A
|
||||
using DecimalResultType = typename BinaryOperationTraits<Op, LeftDataType, RightDataType>::DecimalResultDataType;
|
||||
|
||||
if constexpr (std::is_same_v<ResultDataType, InvalidType>)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
else if constexpr ((std::is_same_v<LeftDataType, DataTypeBFloat16> || std::is_same_v<RightDataType, DataTypeBFloat16>)
|
||||
&& (sizeof(typename LeftDataType::FieldType) > 8 || sizeof(typename RightDataType::FieldType) > 8))
|
||||
{
|
||||
/// Big integers and BFloat16 are not supported together.
|
||||
return nullptr;
|
||||
}
|
||||
else // we can't avoid the else because otherwise the compiler may assume the ResultDataType may be Invalid
|
||||
// and that would produce the compile error.
|
||||
{
|
||||
@ -2060,7 +2068,7 @@ ColumnPtr executeStringInteger(const ColumnsWithTypeAndName & arguments, const A
|
||||
ColumnPtr left_col = nullptr;
|
||||
ColumnPtr right_col = nullptr;
|
||||
|
||||
/// When Decimal op Float32/64, convert both of them into Float64
|
||||
/// When Decimal op Float32/64/16, convert both of them into Float64
|
||||
if constexpr (decimal_with_float)
|
||||
{
|
||||
const auto converted_type = std::make_shared<DataTypeFloat64>();
|
||||
@ -2095,7 +2103,6 @@ ColumnPtr executeStringInteger(const ColumnsWithTypeAndName & arguments, const A
|
||||
/// Here we check if we have `intDiv` or `intDivOrZero` and at least one of the arguments is decimal, because in this case originally we had result as decimal, so we need to convert result into integer after calculations
|
||||
else if constexpr (!decimal_with_float && (is_int_div || is_int_div_or_zero) && (IsDataTypeDecimal<LeftDataType> || IsDataTypeDecimal<RightDataType>))
|
||||
{
|
||||
|
||||
if constexpr (!std::is_same_v<DecimalResultType, InvalidType>)
|
||||
{
|
||||
DataTypePtr type_res;
|
||||
|
Loading…
Reference in New Issue
Block a user