Fix type deduction error

This commit is contained in:
Zach41 2023-11-23 08:11:03 +00:00 committed by ob-robot
parent 8d166a7d96
commit dd4fe92807
3 changed files with 5 additions and 0 deletions

View File

@ -105,6 +105,7 @@ int ObExprAdd::calc_result_type2(ObExprResType &type,
} else if (is_oracle && type.get_precision() > OB_MAX_NUMBER_PRECISION) {
type1.set_calc_type(ObNumberType);
type2.set_calc_type(ObNumberType);
type.set_number();
} else {
if (ObRawExprUtils::decimal_int_need_cast(type1.get_accuracy(), type.get_accuracy()) ||
ObRawExprUtils::decimal_int_need_cast(type2.get_accuracy(), type.get_accuracy())) {

View File

@ -121,6 +121,7 @@ int ObExprMinus::calc_result_type2(ObExprResType &type,
} else if (is_oracle && type.get_precision() > OB_MAX_NUMBER_PRECISION) {
type1.set_calc_type(ObNumberType);
type2.set_calc_type(ObNumberType);
type.set_number();
} else {
if (ObRawExprUtils::decimal_int_need_cast(type1.get_accuracy(), type.get_accuracy()) ||
ObRawExprUtils::decimal_int_need_cast(type2.get_accuracy(), type.get_accuracy())) {

View File

@ -105,6 +105,9 @@ int ObExprMul::calc_result_type2(ObExprResType &type,
} else if (is_oracle && type.get_precision() > OB_MAX_NUMBER_PRECISION) {
type1.set_calc_type(ObNumberType);
type2.set_calc_type(ObNumberType);
type.set_number();
type.set_scale(ORA_NUMBER_SCALE_UNKNOWN_YET);
type.set_precision(PRECISION_UNKNOWN_YET);
} else if ((type1.get_scale() + type2.get_scale() <= OB_MAX_DECIMAL_SCALE)
&& (type1.get_precision() + type2.get_precision() <= MAX_PRECISION_DECIMAL_INT_256)) {
// use specialized functions without additional casts