[BUGFIX] fix uncompress process empty lob res

This commit is contained in:
obdev
2024-02-08 07:25:17 +00:00
committed by ob-robot
parent 9d8405a821
commit cda996a664

View File

@ -141,7 +141,8 @@ static int eval_uncompress_length(const ObExpr &expr,
{
int ret = OB_SUCCESS;
if (str_val.empty()) {
expr_datum.set_string(ObString::make_empty_string());
orig_len = 0;
not_final = true;
} else if (OB_UNLIKELY((str_val.length() <= COMPRESS_HEADER_LEN))) {
expr_datum.set_null();
LOG_USER_WARN(OB_ERR_ZLIB_DATA);
@ -188,7 +189,8 @@ int ObExprUncompress::eval_uncompress(const ObExpr &expr, ObEvalCtx &ctx, ObDatu
int64_t buf_size = 0;
if (OB_FAIL(output_result.init(orig_len))) {
LOG_WARN("init stringtext result failed");
} else if (OB_FAIL(output_result.get_reserved_buffer(buf, buf_size))) {
} else if (orig_len > 0) {
if (OB_FAIL(output_result.get_reserved_buffer(buf, buf_size))) {
LOG_WARN("stringtext result reserve buffer failed");
} else if (OB_UNLIKELY(Z_OK != uncompress(reinterpret_cast<unsigned char*>(buf), &orig_len,
reinterpret_cast<const unsigned char*>(str_val.ptr() + COMPRESS_HEADER_LEN), str_val.length()))) {
@ -199,6 +201,9 @@ int ObExprUncompress::eval_uncompress(const ObExpr &expr, ObEvalCtx &ctx, ObDatu
} else {
output_result.set_result();
}
} else {
output_result.set_result();
}
}
}
return ret;