[BUGFIX] fix ObTextStringIter deconstruct after allocator
This commit is contained in:
@ -402,9 +402,9 @@ struct ObRelationalExtraFunc
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObString l_data;
|
ObString l_data;
|
||||||
ObString r_data;
|
ObString r_data;
|
||||||
|
common::ObArenaAllocator allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||||
ObTextStringIter l_instr_iter(ObLongTextType, cs_type, l.get_string(), true);
|
ObTextStringIter l_instr_iter(ObLongTextType, cs_type, l.get_string(), true);
|
||||||
ObTextStringIter r_instr_iter(ObLongTextType, cs_type, r.get_string(), true);
|
ObTextStringIter r_instr_iter(ObLongTextType, cs_type, r.get_string(), true);
|
||||||
common::ObArenaAllocator allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
|
||||||
if (OB_FAIL(l_instr_iter.init(0, NULL, &allocator))) {
|
if (OB_FAIL(l_instr_iter.init(0, NULL, &allocator))) {
|
||||||
COMMON_LOG(WARN, "Lob: init left text str iter failed", K(ret), K(cs_type), K(l));
|
COMMON_LOG(WARN, "Lob: init left text str iter failed", K(ret), K(cs_type), K(l));
|
||||||
} else if (OB_FAIL(l_instr_iter.get_full_data(l_data))) {
|
} else if (OB_FAIL(l_instr_iter.get_full_data(l_data))) {
|
||||||
@ -442,8 +442,8 @@ struct ObRelationalExtraFunc
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObString l_data;
|
ObString l_data;
|
||||||
ObTextStringIter l_instr_iter(ObLongTextType, cs_type, l.get_string(), true);
|
|
||||||
common::ObArenaAllocator allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
common::ObArenaAllocator allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||||
|
ObTextStringIter l_instr_iter(ObLongTextType, cs_type, l.get_string(), true);
|
||||||
if (OB_FAIL(l_instr_iter.init(0, NULL, &allocator))) {
|
if (OB_FAIL(l_instr_iter.init(0, NULL, &allocator))) {
|
||||||
COMMON_LOG(WARN, "Lob: init left text str iter failed", K(ret), K(cs_type), K(l));
|
COMMON_LOG(WARN, "Lob: init left text str iter failed", K(ret), K(cs_type), K(l));
|
||||||
} else if (OB_FAIL(l_instr_iter.get_full_data(l_data))) {
|
} else if (OB_FAIL(l_instr_iter.get_full_data(l_data))) {
|
||||||
@ -477,8 +477,8 @@ struct ObRelationalExtraFunc
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObString r_data;
|
ObString r_data;
|
||||||
ObTextStringIter r_instr_iter(ObLongTextType, cs_type, r.get_string(), true);
|
|
||||||
common::ObArenaAllocator allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
common::ObArenaAllocator allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||||
|
ObTextStringIter r_instr_iter(ObLongTextType, cs_type, r.get_string(), true);
|
||||||
if (OB_FAIL(r_instr_iter.init(0, NULL, &allocator))) {
|
if (OB_FAIL(r_instr_iter.init(0, NULL, &allocator))) {
|
||||||
COMMON_LOG(WARN, "Lob: init right text str iter failed", K(ret), K(ret), K(r));
|
COMMON_LOG(WARN, "Lob: init right text str iter failed", K(ret), K(ret), K(r));
|
||||||
} else if (OB_FAIL(r_instr_iter.get_full_data(r_data))) {
|
} else if (OB_FAIL(r_instr_iter.get_full_data(r_data))) {
|
||||||
|
|||||||
@ -88,12 +88,12 @@ int ObExprConcat::calc_text(common::ObObj &result,
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
int32_t max_length = OB_MAX_PACKET_LENGTH;
|
int32_t max_length = OB_MAX_PACKET_LENGTH;
|
||||||
|
// use a temp allocator to read lob data, the input allocator may not alloc more then once
|
||||||
|
common::ObArenaAllocator temp_allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||||
ObTextStringIter str_iter1(obj1);
|
ObTextStringIter str_iter1(obj1);
|
||||||
ObTextStringIter str_iter2(obj2);
|
ObTextStringIter str_iter2(obj2);
|
||||||
int64_t str1_byte_len = 0;
|
int64_t str1_byte_len = 0;
|
||||||
int64_t str2_byte_len = 0;
|
int64_t str2_byte_len = 0;
|
||||||
// use a temp allocator to read lob data, the input allocator may not alloc more then once
|
|
||||||
common::ObArenaAllocator temp_allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
|
||||||
if (OB_FAIL(str_iter1.init(0, NULL, &temp_allocator))) {
|
if (OB_FAIL(str_iter1.init(0, NULL, &temp_allocator))) {
|
||||||
LOG_WARN("init str_iter1 failed ", K(ret), K(str_iter1));
|
LOG_WARN("init str_iter1 failed ", K(ret), K(str_iter1));
|
||||||
} else if (OB_FAIL(str_iter2.init(0, NULL, &temp_allocator))) {
|
} else if (OB_FAIL(str_iter2.init(0, NULL, &temp_allocator))) {
|
||||||
|
|||||||
@ -226,12 +226,12 @@ int ObExprConvertOracle::calc_convert_oracle_expr(const ObExpr &expr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // text tc
|
} else { // text tc
|
||||||
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
ObTextStringIter src_iter(expr.args_[0]->datum_meta_.type_,
|
ObTextStringIter src_iter(expr.args_[0]->datum_meta_.type_,
|
||||||
src_cs_type,
|
src_cs_type,
|
||||||
src_param->get_string(),
|
src_param->get_string(),
|
||||||
expr.args_[0]->obj_meta_.has_lob_header());
|
expr.args_[0]->obj_meta_.has_lob_header());
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
|
||||||
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &res_datum);
|
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &res_datum);
|
||||||
int64_t src_byte_len = 0;
|
int64_t src_byte_len = 0;
|
||||||
int64_t buf_size = 0;
|
int64_t buf_size = 0;
|
||||||
|
|||||||
@ -161,11 +161,11 @@ int calc_initcap_expr(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res_datum)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // text tc
|
} else { // text tc
|
||||||
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
ObTextStringIter input_iter(expr.args_[0]->datum_meta_.type_, cs_type,
|
ObTextStringIter input_iter(expr.args_[0]->datum_meta_.type_, cs_type,
|
||||||
arg_datum->get_string(),
|
arg_datum->get_string(),
|
||||||
expr.args_[0]->obj_meta_.has_lob_header());
|
expr.args_[0]->obj_meta_.has_lob_header());
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
|
||||||
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &res_datum);
|
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &res_datum);
|
||||||
int64_t input_byte_len = 0;
|
int64_t input_byte_len = 0;
|
||||||
int64_t buf_size = 0;
|
int64_t buf_size = 0;
|
||||||
|
|||||||
@ -588,10 +588,10 @@ int ObExprOracleInstr::calc_oracle_instr_expr(const ObExpr &expr, ObEvalCtx &ctx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // at least one of the inputs is text tc
|
} else { // at least one of the inputs is text tc
|
||||||
ObTextStringIter haystack_iter(haystack_type, calc_cs_type, haystack->get_string(), haystack_has_lob_header);
|
|
||||||
ObTextStringIter needle_iter(needle_type, calc_cs_type, needle->get_string(), needle_has_lob_header);
|
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
|
ObTextStringIter haystack_iter(haystack_type, calc_cs_type, haystack->get_string(), haystack_has_lob_header);
|
||||||
|
ObTextStringIter needle_iter(needle_type, calc_cs_type, needle->get_string(), needle_has_lob_header);
|
||||||
|
|
||||||
if (OB_FAIL(calc_oracle_instr_text(haystack_iter, needle_iter,
|
if (OB_FAIL(calc_oracle_instr_text(haystack_iter, needle_iter,
|
||||||
calc_alloc, calc_cs_type, pos_int, occ_int, idx))) {
|
calc_alloc, calc_cs_type, pos_int, occ_int, idx))) {
|
||||||
|
|||||||
@ -272,11 +272,11 @@ int calc_instrb_expr(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res_datum)
|
|||||||
res_datum.set_number(res_nmb);
|
res_datum.set_number(res_nmb);
|
||||||
}
|
}
|
||||||
} else { // text types
|
} else { // text types
|
||||||
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
// similar to instr, but reserve length is byte len, use binary cs type for byte access
|
// similar to instr, but reserve length is byte len, use binary cs type for byte access
|
||||||
ObTextStringIter haystack_iter(haystack_type, CS_TYPE_BINARY, haystack->get_string(), haystack_has_lob_header);
|
ObTextStringIter haystack_iter(haystack_type, CS_TYPE_BINARY, haystack->get_string(), haystack_has_lob_header);
|
||||||
ObTextStringIter needle_iter(needle_type, calc_cs_type, needle->get_string(), needle_has_lob_header);
|
ObTextStringIter needle_iter(needle_type, calc_cs_type, needle->get_string(), needle_has_lob_header);
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
|
||||||
|
|
||||||
if (OB_FAIL(calc_instrb_text(haystack_iter, needle_iter, calc_alloc,
|
if (OB_FAIL(calc_instrb_text(haystack_iter, needle_iter, calc_alloc,
|
||||||
kmp_ctx, ctx, pos_int, occ_int, res_datum))) {
|
kmp_ctx, ctx, pos_int, occ_int, res_datum))) {
|
||||||
|
|||||||
@ -142,10 +142,10 @@ int ObExprLowerUpper::calc(ObObj &result, const ObString &text,
|
|||||||
ObString real_str;
|
ObString real_str;
|
||||||
int32_t multiply = get_case_mutiply(cs_type);
|
int32_t multiply = get_case_mutiply(cs_type);
|
||||||
ObObjType text_type = get_result_type().get_calc_meta().get_type();
|
ObObjType text_type = get_result_type().get_calc_meta().get_type();
|
||||||
// not found caller of this func, need text src obj to judge whether has lob header
|
|
||||||
ObTextStringIter src_iter(text_type, cs_type, text, has_lob_header);
|
|
||||||
// Need calc buff, user AreanaAllocator instead, for cannot find the caller of this function
|
// Need calc buff, user AreanaAllocator instead, for cannot find the caller of this function
|
||||||
common::ObArenaAllocator temp_allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
common::ObArenaAllocator temp_allocator(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||||
|
// not found caller of this func, need text src obj to judge whether has lob header
|
||||||
|
ObTextStringIter src_iter(text_type, cs_type, text, has_lob_header);
|
||||||
char *buf = NULL; // res buffer
|
char *buf = NULL; // res buffer
|
||||||
int64_t src_byte_len = 0;
|
int64_t src_byte_len = 0;
|
||||||
int64_t buf_size = 0;
|
int64_t buf_size = 0;
|
||||||
@ -388,11 +388,10 @@ int ObExprLowerUpper::calc_common(const ObExpr &expr, ObEvalCtx &ctx,
|
|||||||
str_result.assign(buf, static_cast<int32_t>(out_len));
|
str_result.assign(buf, static_cast<int32_t>(out_len));
|
||||||
}
|
}
|
||||||
} else { // text tc only
|
} else { // text tc only
|
||||||
ObTextStringIter src_iter(text_meta.type_, text_meta.cs_type_, text_datum->get_string(), has_lob_header);
|
|
||||||
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &expr_datum);
|
|
||||||
|
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
|
ObTextStringIter src_iter(text_meta.type_, text_meta.cs_type_, text_datum->get_string(), has_lob_header);
|
||||||
|
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &expr_datum);
|
||||||
|
|
||||||
ObString dst;
|
ObString dst;
|
||||||
char *buf = NULL; // res buffer
|
char *buf = NULL; // res buffer
|
||||||
|
|||||||
@ -5320,14 +5320,14 @@ int ObLocationExprOperator::calc_(const ObExpr &expr, const ObExpr &sub_arg,
|
|||||||
sub_str.ptr(), sub_str.length(), pos_int);
|
sub_str.ptr(), sub_str.length(), pos_int);
|
||||||
res_datum.set_int(static_cast<int64_t>(idx));
|
res_datum.set_int(static_cast<int64_t>(idx));
|
||||||
} else { // at least one of the inputs are text tc
|
} else { // at least one of the inputs are text tc
|
||||||
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
ObString sub_str_data;
|
ObString sub_str_data;
|
||||||
ObString ori_str_data;
|
ObString ori_str_data;
|
||||||
bool sub_has_lob_header = sub_arg.obj_meta_.has_lob_header();
|
bool sub_has_lob_header = sub_arg.obj_meta_.has_lob_header();
|
||||||
bool ori_has_lob_header = ori_arg.obj_meta_.has_lob_header();
|
bool ori_has_lob_header = ori_arg.obj_meta_.has_lob_header();
|
||||||
ObTextStringIter sub_str_iter(sub_arg.datum_meta_.type_, sub_arg.datum_meta_.cs_type_, sub_str, sub_has_lob_header);
|
ObTextStringIter sub_str_iter(sub_arg.datum_meta_.type_, sub_arg.datum_meta_.cs_type_, sub_str, sub_has_lob_header);
|
||||||
ObTextStringIter ori_str_iter(ori_arg.datum_meta_.type_, ori_arg.datum_meta_.cs_type_, ori_str, ori_has_lob_header);
|
ObTextStringIter ori_str_iter(ori_arg.datum_meta_.type_, ori_arg.datum_meta_.cs_type_, ori_str, ori_has_lob_header);
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
|
||||||
if (OB_FAIL(ori_str_iter.init(0, NULL, &calc_alloc))) {
|
if (OB_FAIL(ori_str_iter.init(0, NULL, &calc_alloc))) {
|
||||||
LOG_WARN("Lob: init ori_str_iter failed ", K(ret), K(ori_str_iter));
|
LOG_WARN("Lob: init ori_str_iter failed ", K(ret), K(ori_str_iter));
|
||||||
} else if (OB_FAIL(sub_str_iter.init(0, NULL, &calc_alloc))) {
|
} else if (OB_FAIL(sub_str_iter.init(0, NULL, &calc_alloc))) {
|
||||||
|
|||||||
@ -101,14 +101,14 @@ int calc_reverse_expr(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res_datum)
|
|||||||
res_datum.set_string(res_str);
|
res_datum.set_string(res_str);
|
||||||
}
|
}
|
||||||
} else { // text tc
|
} else { // text tc
|
||||||
|
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||||
|
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
||||||
char *buf;
|
char *buf;
|
||||||
int64_t buf_size = 0;
|
int64_t buf_size = 0;
|
||||||
int64_t total_byte_len = 0;
|
int64_t total_byte_len = 0;
|
||||||
const bool has_lob_header = expr.args_[0]->obj_meta_.has_lob_header();
|
const bool has_lob_header = expr.args_[0]->obj_meta_.has_lob_header();
|
||||||
ObTextStringIter input_iter(expr.args_[0]->datum_meta_.type_, arg_cs_type, arg->get_string(), has_lob_header);
|
ObTextStringIter input_iter(expr.args_[0]->datum_meta_.type_, arg_cs_type, arg->get_string(), has_lob_header);
|
||||||
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &res_datum);
|
ObTextStringDatumResult output_result(expr.datum_meta_.type_, &expr, &ctx, &res_datum);
|
||||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
|
||||||
ObIAllocator &calc_alloc = alloc_guard.get_allocator();
|
|
||||||
if (OB_FAIL(input_iter.init(0, NULL, &calc_alloc))) {
|
if (OB_FAIL(input_iter.init(0, NULL, &calc_alloc))) {
|
||||||
LOG_WARN("init input_iter failed ", K(ret), K(input_iter));
|
LOG_WARN("init input_iter failed ", K(ret), K(input_iter));
|
||||||
} else if (OB_FAIL(input_iter.get_byte_len(total_byte_len))) {
|
} else if (OB_FAIL(input_iter.get_byte_len(total_byte_len))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user