Bugfix for API common_copy_string_zf when vectorization is ON
This commit is contained in:
@ -515,16 +515,10 @@ static int common_copy_string(const ObExpr &expr,
|
||||
int ret = OB_SUCCESS;
|
||||
char *out_ptr = NULL;
|
||||
int64_t len = align_offset + src.length();
|
||||
if (expr.res_buf_len_ < len) {
|
||||
if (OB_ISNULL(out_ptr = expr.get_str_res_mem(ctx, len))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate memory failed", K(ret));
|
||||
}
|
||||
if (OB_ISNULL(out_ptr = expr.get_str_res_mem(ctx, len))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate memory failed", K(ret));
|
||||
} else {
|
||||
out_ptr = const_cast<char*>(res_datum.ptr_);
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
MEMMOVE(out_ptr + align_offset, src.ptr(), len - align_offset);
|
||||
MEMSET(out_ptr, 0, align_offset);
|
||||
res_datum.set_string(out_ptr, len);
|
||||
@ -552,16 +546,10 @@ static int common_copy_string_zf(const ObExpr &expr,
|
||||
} else if (CM_IS_ZERO_FILL(expr.extra_) && out_len > src.length()) {
|
||||
char *out_ptr = NULL;
|
||||
// out_ptr may overlap with src, so memmove is used.
|
||||
if (expr.res_buf_len_ < out_len) {
|
||||
if (OB_ISNULL(out_ptr = expr.get_str_res_mem(ctx, out_len))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate memory failed", K(ret));
|
||||
}
|
||||
if (OB_ISNULL(out_ptr = expr.get_str_res_mem(ctx, out_len))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("allocate memory failed", K(ret));
|
||||
} else {
|
||||
out_ptr = const_cast<char*>(res_datum.ptr_);
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
int64_t zf_len = out_len - src.length();
|
||||
if (0 < zf_len) {
|
||||
MEMMOVE(out_ptr + zf_len, src.ptr(), src.length());
|
||||
|
||||
Reference in New Issue
Block a user