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

@ -12,9 +12,9 @@
#ifndef OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_INFORMATION_KVCACHE_TABLE_
#define OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_INFORMATION_KVCACHE_TABLE_
#include "share/ob_virtual_table_scanner_iterator.h"
#include "share/cache/ob_kv_storecache.h"
#include "share/ob_virtual_table_scanner_iterator.h"
#include "share/cache/ob_kv_storecache.h"
#include "lib/stat/ob_di_cache.h"

View File

@ -179,7 +179,9 @@ int ObExprFromBase64::eval_from_base64_batch(const ObExpr &expr, ObEvalCtx &ctx,
const ObString & in_raw = arg->get_string();
ObLength in_raw_len = in_raw.length();
const char *buf = in_raw.ptr();
if (NULL == buf) {
if (arg->is_null()) {
res[j].set_null();
} else if (NULL == buf) {
res[j].set_string(nullptr, 0);
} else {
char *output_buf = nullptr;

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;