Fix base64 bug: ob doesn't return null as expected

This commit is contained in:
obdev
2023-01-04 11:38:19 +00:00
committed by ob-robot
parent a2c0577954
commit 1c9259243e
3 changed files with 10 additions and 6 deletions

View File

@ -172,8 +172,10 @@ int ObExprToBase64::eval_to_base64_batch(const ObExpr &expr,
ObLength in_raw_len = in_raw.length();
const char *buf = in_raw.ptr();
char *output_buf = nullptr;
int64_t buf_len = base64_needed_encoded_length(in_raw_len);
if (OB_UNLIKELY(buf_len == 0)) {
int64_t buf_len = 0;
if (arg->is_null()) {
res[j].set_null();
} else if (OB_UNLIKELY((buf_len = base64_needed_encoded_length(in_raw_len)) == 0)) {
res[j].set_string(nullptr, 0);
} else {
int64_t pos = 0;