diff --git a/src/Functions/FunctionBinaryArithmetic.h b/src/Functions/FunctionBinaryArithmetic.h index bbac58a92c6..bbb08c4068f 100644 --- a/src/Functions/FunctionBinaryArithmetic.h +++ b/src/Functions/FunctionBinaryArithmetic.h @@ -65,7 +65,7 @@ namespace ErrorCodes */ template -struct BinaryOperationImplBase +struct BinaryOperation { using ResultType = ResultType_; static const constexpr bool allow_fixed_string = false; @@ -167,16 +167,24 @@ struct FixedStringOperationImpl template -struct BinaryOperationImpl : BinaryOperationImplBase +struct BinaryOperationImpl : BinaryOperation { }; +template +inline constexpr const auto & undec(const T & x) +{ + if constexpr (IsDecimalNumber) + return x.value; + else + return x; +} /// Binary operations for Decimals need scale args /// +|- scale one of args (which scale factor is not 1). ScaleR = oneof(Scale1, Scale2); /// * no agrs scale. ScaleR = Scale1 + Scale2; /// / first arg scale. ScaleR = Scale1 (scale_a = DecimalType::getScale()). -template typename Operation, typename ResultType_, bool _check_overflow = true> +template