[CP] Repair type conversion range check of year to tinyint or utinyint

This commit is contained in:
obdev
2022-07-22 10:44:45 +08:00
committed by wangzelin.wzl
parent b96d7663b5
commit fc3e6e947b

View File

@ -3478,7 +3478,8 @@ CAST_FUNC_NAME(year, int)
{
uint8_t in_val = child_res->get_uint8();
int64_t out_val = 0;
if (OB_FAIL(common_year_int(expr, ObIntType, in_val, out_val))) {
ObObjType out_type = expr.datum_meta_.type_;
if (OB_FAIL(common_year_int(expr, out_type, in_val, out_val))) {
LOG_WARN("common_year_int failed", K(ret));
} else {
res_datum.set_int(out_val);
@ -3498,7 +3499,7 @@ CAST_FUNC_NAME(year, uint)
LOG_WARN("year_to_int failed", K(ret));
} else {
out_val = static_cast<uint64_t>(val_int);
if (out_type < ObSmallIntType && CAST_FAIL(uint_range_check(out_type, val_int, out_val))) {
if (out_type < ObUSmallIntType && CAST_FAIL(uint_range_check(out_type, val_int, out_val))) {
LOG_WARN("uint_range_check failed", K(ret));
} else {
res_datum.set_uint(out_val);