[CP][BUGFIX] fix text substr len 0 error
This commit is contained in:
@ -77,6 +77,10 @@ void ObTextStringDatumResult::set_result()
|
||||
res_datum_->set_string(buffer_, pos_);
|
||||
}
|
||||
|
||||
void ObTextStringDatumResult::set_result_null()
|
||||
{
|
||||
res_datum_->set_null();
|
||||
}
|
||||
|
||||
int ObTextStringObObjResult::init(int64_t res_len, ObIAllocator *allocator)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
int init(int64_t res_len, ObIAllocator *allocator = NULL);
|
||||
int init_with_batch_idx(int64_t res_len, int64_t batch_idx);
|
||||
void set_result();
|
||||
|
||||
void set_result_null();
|
||||
private:
|
||||
char * buff_alloc (const int64_t size);
|
||||
|
||||
|
@ -557,7 +557,9 @@ static int eval_substr_text(const ObCollationType &cs_type,
|
||||
} else if (OB_FAIL(input_iter.get_char_len(total_char_len))) {
|
||||
LOG_WARN("get input char len failed", K(ret));
|
||||
} else if (FALSE_IT(result_byte_len = MIN((pos >= 0 ? total_byte_len - pos + 1 : -pos * mbmaxlen), (MIN((len), (total_char_len)) * mbmaxlen)))) {
|
||||
} else if (len < 0 || pos > total_char_len) {
|
||||
} else if (len <= 0 && lib::is_oracle_mode()) {
|
||||
output_result.set_result_null();
|
||||
} else if (pos > total_char_len || len <= 0) {
|
||||
if (!is_batch) {
|
||||
ret = output_result.init(0); // fill empty lob result
|
||||
} else {
|
||||
@ -574,8 +576,6 @@ static int eval_substr_text(const ObCollationType &cs_type,
|
||||
} else {
|
||||
ret = output_result.init_with_batch_idx(result_byte_len, batch_idx);
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_WARN("init stringtext result failed", K(ret));
|
||||
} else {
|
||||
@ -616,6 +616,7 @@ static int eval_substr_text(const ObCollationType &cs_type,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user