Fix section code REVERSE_ INULL, DIVIDE_ BY_ ZERO's problem

This commit is contained in:
obdev
2024-01-10 10:30:07 +00:00
committed by ob-robot
parent 104a9f60d0
commit db305bcbc0
3 changed files with 35 additions and 24 deletions

View File

@ -321,24 +321,29 @@ int ObDtlVectors::init(const common::ObIArray<ObExpr*> &exprs, ObEvalCtx &ctx)
} }
} }
if (OB_SUCC(ret) && *col_cnt_ > 0) { if (OB_SUCC(ret) && *col_cnt_ > 0) {
row_size_ = row_size; if (row_size != 0){
row_limit_ = remain_size / row_size; row_size_ = row_size;
if (row_size * row_limit_ + *col_cnt_ * ObBitVector::memory_size(row_limit_) > remain_size) { row_limit_ = remain_size / row_size;
row_limit_ = (remain_size - *col_cnt_ * ObBitVector::memory_size(row_limit_)) / row_size; if (row_size * row_limit_ + *col_cnt_ * ObBitVector::memory_size(row_limit_) > remain_size) {
} row_limit_ = (remain_size - *col_cnt_ * ObBitVector::memory_size(row_limit_)) / row_size;
if (row_limit_ <= 0) {
ret =OB_ERR_UNEXPECTED;
LOG_WARN("failed to calc max row cnt", K(remain_size), K(row_size), K(ret));
} else {
for (int64_t i = 0; i < exprs.count(); ++i) {
VectorInfo &info = infos_[i];
info.nulls_offset_ = pos;
ObBitVector *nulls = to_bit_vector(buf_ + pos);
nulls->reset(row_limit_);
pos += ObBitVector::memory_size(row_limit_);
info.data_offset_ = pos;
pos += row_limit_ * info.fixed_len_;
} }
if (row_limit_ <= 0) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("failed to calc max row cnt", K(remain_size), K(row_size), K(ret));
} else {
for (int64_t i = 0; i < exprs.count(); ++i) {
VectorInfo &info = infos_[i];
info.nulls_offset_ = pos;
ObBitVector *nulls = to_bit_vector(buf_ + pos);
nulls->reset(row_limit_);
pos += ObBitVector::memory_size(row_limit_);
info.data_offset_ = pos;
pos += row_limit_ * info.fixed_len_;
}
}
} else {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected row_size", K(row_size), K(ret));
} }
} }
} }

View File

@ -633,9 +633,7 @@ void ObChunkDatumStore::reset()
if (nullptr != callback_) { if (nullptr != callback_) {
callback_->free(item->get_buffer()->mem_size()); callback_->free(item->get_buffer()->mem_size());
} }
if (NULL != item) { allocator_->free(item);
allocator_->free(item);
}
} }
if (NULL != batch_ctx_) { if (NULL != batch_ctx_) {

View File

@ -607,14 +607,18 @@ void ObHashJoinOp::part_rescan()
for (int64_t i = 0; i < part_count_; i ++) { for (int64_t i = 0; i < part_count_; i ++) {
hj_part_array_[i].~ObHashJoinPartition(); hj_part_array_[i].~ObHashJoinPartition();
} }
alloc_->free(hj_part_array_); if (OB_NOT_NULL(alloc_)) {
alloc_->free(hj_part_array_);
}
hj_part_array_ = NULL; hj_part_array_ = NULL;
} }
if (right_hj_part_array_ != NULL) { if (right_hj_part_array_ != NULL) {
for (int64_t i = 0; i < part_count_; i ++) { for (int64_t i = 0; i < part_count_; i ++) {
right_hj_part_array_[i].~ObHashJoinPartition(); right_hj_part_array_[i].~ObHashJoinPartition();
} }
alloc_->free(right_hj_part_array_); if (OB_NOT_NULL(alloc_)) {
alloc_->free(right_hj_part_array_);
}
right_hj_part_array_ = NULL; right_hj_part_array_ = NULL;
} }
int64_t tmp_part_count = 0 < level2_part_count_ ? int64_t tmp_part_count = 0 < level2_part_count_ ?
@ -624,11 +628,15 @@ void ObHashJoinOp::part_rescan()
for (int64_t i = 0; i < tmp_part_count; i ++) { for (int64_t i = 0; i < tmp_part_count; i ++) {
part_histograms_[i].~HashJoinHistogram(); part_histograms_[i].~HashJoinHistogram();
} }
alloc_->free(part_histograms_); if (OB_NOT_NULL(alloc_)) {
alloc_->free(part_histograms_);
}
part_histograms_ = NULL; part_histograms_ = NULL;
} }
if (OB_NOT_NULL(part_selectors_)) { if (OB_NOT_NULL(part_selectors_)) {
alloc_->free(part_selectors_); if (OB_NOT_NULL(alloc_)) {
alloc_->free(part_selectors_);
}
part_selectors_ = nullptr; part_selectors_ = nullptr;
part_selector_sizes_ = nullptr; part_selector_sizes_ = nullptr;
} }