replaced ternary if

This commit is contained in:
myrrc 2020-12-18 16:35:37 +03:00
parent 84013d253d
commit 15f0915ad3

View File

@ -1025,21 +1025,27 @@ public:
else if constexpr (result_is_decimal) else if constexpr (result_is_decimal)
left_scale = type.scaleFactorFor(left, is_multiply); //both are decimal, so multiply on 1 / scale left_scale = type.scaleFactorFor(left, is_multiply); //both are decimal, so multiply on 1 / scale
else if constexpr (left_is_decimal) else if constexpr (left_is_decimal)
{
// While multiplying constants, we need the Decimal scales as the conversion function from // While multiplying constants, we need the Decimal scales as the conversion function from
// Decimal utils takes it. When one of the columns is non-const, we need the scale multiplier // Decimal utils takes it. When one of the columns is non-const, we need the scale multiplier
// instead as the OpImpl::constantConstant function uses the multiplier. // instead as the OpImpl::constantConstant function uses the multiplier.
left_scale = both_columns_are_const if (both_columns_are_const)
? left.getScale() left_scale = left.getScale();
: left.template getScaleMultiplier<FieldType>(); else
left_scale = left.getScaleMultiplier();
}
else else
left_scale = 0.0; //won't be used, just to silence the warning left_scale = 0.0; //won't be used, just to silence the warning
if constexpr (result_is_decimal) if constexpr (result_is_decimal)
right_scale = type.scaleFactorFor(right, is_multiply || is_division); right_scale = type.scaleFactorFor(right, is_multiply || is_division);
else if constexpr (right_is_decimal) else if constexpr (right_is_decimal)
right_scale = both_columns_are_const {
? right.getScale() if (both_columns_are_const)
: right.template getScaleMultiplier<FieldType>(); right_scale = right.getScale();
else
right_scale = right.getScaleMultiplier();
}
else else
right_scale = 0.0; //same right_scale = 0.0; //same