Fix bug about second and microsecond function and update cases

This commit is contained in:
obdev
2022-12-06 14:35:58 +00:00
committed by ob-robot
parent 4d38a86de9
commit 676c105da8
4 changed files with 60 additions and 47 deletions

View File

@ -116,8 +116,10 @@ inline int ObExprSecond::calc_result_type1(ObExprResType &type,
type.set_precision(4);
type.set_scale(0);
common::ObObjTypeClass tc1 = ob_obj_type_class(type1.get_type());
if ((common::ObEnumSetTC == tc1) || (common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
if ((common::ObEnumSetTC == tc1)) {
type1.set_calc_type_default_varchar();
} else if ((common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
type1.set_calc_type(common::ObNumberType);
}
return common::OB_SUCCESS;
}
@ -144,8 +146,10 @@ inline int ObExprMicrosecond::calc_result_type1(ObExprResType &type,
type.set_precision(4);
type.set_scale(0);
common::ObObjTypeClass tc1 = ob_obj_type_class(type1.get_type());
if ((common::ObEnumSetTC == tc1) || (common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
if ((common::ObEnumSetTC == tc1)) {
type1.set_calc_type_default_varchar();
} else if ((common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
type1.set_calc_type(common::ObNumberType);
}
return common::OB_SUCCESS;
}