[BUGFIX] fix lob bugs

This commit is contained in:
obdev
2023-03-22 08:45:44 +00:00
committed by ob-robot
parent 3af5758e15
commit 579345ca09
4 changed files with 36 additions and 6 deletions

View File

@ -340,6 +340,8 @@ int ObExprOutputPack::convert_text_value_charset(common::ObObj& value,
// do nothing
} else if (OB_FAIL(lob.get_inrow_data(inrow_data))) {
LOG_WARN("fail to get inrow data", K(ret), K(lob));
} else if (inrow_data.length() == 0) {
// do nothing
} else {
int64_t lob_data_byte_len = inrow_data.length();
int64_t offset_len = reinterpret_cast<uint64_t>(inrow_data.ptr()) - reinterpret_cast<uint64_t>(lob.ptr_);
@ -494,12 +496,24 @@ int ObExprOutputPack::process_lob_locator_results(common::ObObj& value,
ObLobLocatorV2 loc(value.get_string(), value.has_lob_header());
if (loc.is_lob_locator_v1()) { // do nothing, lob locator version 1
} else if (loc.is_valid()) { // lob locator v2
if (!loc.has_extern()) { // if has header but without extern header
if (!loc.has_lob_header()) { // consider 4.0 will return no lob header obj
ObString data = value.get_string();
ObTextStringResult new_tmp_lob(value.get_type(), true, &alloc);
if (OB_FAIL(new_tmp_lob.init(data.length()))) {
LOG_WARN("fail to init text string result", K(ret), K(new_tmp_lob), K(data.length()));
} else if (OB_FAIL(new_tmp_lob.append(data))) {
LOG_WARN("fail to append data", K(ret), K(new_tmp_lob), K(data.length()));
} else {
ObString res;
new_tmp_lob.get_result_buffer(res);
value.set_lob_value(value.get_type(), res.ptr(), res.length());
value.set_has_lob_header(); // must has lob header
}
} else if (!loc.has_extern()) { // if has header but without extern header
// mock loc v2 with extern ? currently all temp lobs have extern field in oracle mode
// should not come here
OB_ASSERT(0);
}
if (!is_support_outrow_locator_v2 && !loc.has_inrow_data()) {
} else if (!is_support_outrow_locator_v2 && !loc.has_inrow_data()) {
if (OB_FAIL(ObTextStringIter::append_outrow_lob_fulldata(value, &my_session, alloc))) {
LOG_WARN("Lob: convert lob to outrow failed", K(value), K(GET_MIN_CLUSTER_VERSION()));
}