[BUGFIX] fix uncompress process empty lob res
This commit is contained in:
parent
ad14884156
commit
cd8279dccb
@ -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,14 +189,18 @@ 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))) {
|
||||
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()))) {
|
||||
expr_datum.set_null();
|
||||
LOG_USER_WARN(OB_ERR_ZLIB_DATA);
|
||||
} else if (OB_FAIL(output_result.lseek(orig_len, 0))) {
|
||||
LOG_WARN("result lseek failed", K(ret));
|
||||
} 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()))) {
|
||||
expr_datum.set_null();
|
||||
LOG_USER_WARN(OB_ERR_ZLIB_DATA);
|
||||
} else if (OB_FAIL(output_result.lseek(orig_len, 0))) {
|
||||
LOG_WARN("result lseek failed", K(ret));
|
||||
} else {
|
||||
output_result.set_result();
|
||||
}
|
||||
} else {
|
||||
output_result.set_result();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user