提交 8064e195 编写于 作者: B br0 提交者: wangzelin.wzl

Fix casting error for year to bit

上级 df707d35
......@@ -3400,10 +3400,10 @@ static int year_bit(
if (OB_UNLIKELY(ObYearTC != in.get_type_class() || ObBitTC != ob_obj_type_class(expect_type))) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("invalid input type", K(ret), K(in), K(expect_type));
} else if (OB_FAIL(year_string(ObVarcharType, params, in, tmp_val, cast_mode))) {
LOG_WARN("fail to cast datetime to string", K(ret), K(expect_type), K(in), K(tmp_val));
} else if (OB_FAIL(string_bit(expect_type, params, tmp_val, out, cast_mode))) {
LOG_WARN("fail to cast string to bit", K(ret), K(expect_type), K(in), K(tmp_val));
} else if (OB_FAIL(year_int(ObIntType, params, in, tmp_val, cast_mode))) {
LOG_WARN("fail to cast datetime to int", K(ret), K(expect_type), K(in), K(tmp_val));
} else if (OB_FAIL(int_bit(expect_type, params, tmp_val, out, cast_mode))) {
LOG_WARN("fail to cast int to bit", K(ret), K(expect_type), K(in), K(tmp_val));
}
return ret;
}
......
......@@ -3273,16 +3273,12 @@ CAST_FUNC_NAME(year, bit)
{
EVAL_ARG()
{
char buf[OB_CAST_TO_VARCHAR_MAX_LENGTH] = {0};
int64_t len = 0;
int64_t year_int = 0;
uint8_t in_val = child_res->get_uint8();
if (OB_FAIL(ObTimeConverter::year_to_str(in_val, buf, sizeof(buf), len))) {
LOG_WARN("year_to_str failed", K(ret));
} else {
ObString in_str(len, buf);
if (OB_FAIL(common_string_bit(expr, in_str, ctx, res_datum))) {
LOG_WARN("common_string_bit failed", K(ret), K(in_str));
}
if (OB_FAIL(ObTimeConverter::year_to_int(in_val, year_int))) {
LOG_WARN("year_to_int failed", K(ret), K(in_val));
} else if (OB_FAIL(common_uint_bit(expr, year_int, ctx, res_datum))) {
LOG_WARN("common_uint_bit failed", K(ret), K(year_int));
}
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册