[CP] fix hexstring convert bug

This commit is contained in:
2149 2023-07-11 13:24:28 +00:00 committed by ob-robot
parent 87608e7bff
commit 18c3958dbe

View File

@ -4915,7 +4915,19 @@ int common_string_integer(const ObCastMode &cast_mode,
{
int ret = OB_SUCCESS;
if (ObHexStringType == in_type) {
out_val = static_cast<int64_t>(hex_to_uint64(in_str));
ObObj uint64_in;
ObObj out;
ObObjCastParams dummy;
ObCastMode uint_int_cm = cast_mode;
uint64_in.set_uint64(hex_to_uint64(in_str));
if (CM_IS_EXPLICIT_CAST(cast_mode)) {
uint_int_cm |= CM_NO_RANGE_CHECK;
}
if (OB_FAIL(uint_int(ObIntType, dummy, uint64_in, out, uint_int_cm))) {
LOG_WARN("convert hex string to int64 failed", K(ret));
} else {
out_val = out.get_int();
}
} else {
int err = 0;
char *endptr = NULL;