diff --git a/src/sql/dtl/ob_dtl_vectors_buffer.cpp b/src/sql/dtl/ob_dtl_vectors_buffer.cpp index a0e527f2b0..4b1d8c15e1 100644 --- a/src/sql/dtl/ob_dtl_vectors_buffer.cpp +++ b/src/sql/dtl/ob_dtl_vectors_buffer.cpp @@ -321,24 +321,29 @@ int ObDtlVectors::init(const common::ObIArray &exprs, ObEvalCtx &ctx) } } if (OB_SUCC(ret) && *col_cnt_ > 0) { - row_size_ = row_size; - row_limit_ = remain_size / 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_size != 0){ + row_size_ = row_size; + row_limit_ = remain_size / 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_; + } + } + } else { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected row_size", K(row_size), K(ret)); } } } diff --git a/src/sql/engine/basic/ob_chunk_datum_store.cpp b/src/sql/engine/basic/ob_chunk_datum_store.cpp index a5e5129756..7a60858237 100644 --- a/src/sql/engine/basic/ob_chunk_datum_store.cpp +++ b/src/sql/engine/basic/ob_chunk_datum_store.cpp @@ -633,9 +633,7 @@ void ObChunkDatumStore::reset() if (nullptr != callback_) { callback_->free(item->get_buffer()->mem_size()); } - if (NULL != item) { - allocator_->free(item); - } + allocator_->free(item); } if (NULL != batch_ctx_) { diff --git a/src/sql/engine/join/ob_hash_join_op.cpp b/src/sql/engine/join/ob_hash_join_op.cpp index 3093213105..5d7644f901 100644 --- a/src/sql/engine/join/ob_hash_join_op.cpp +++ b/src/sql/engine/join/ob_hash_join_op.cpp @@ -607,14 +607,18 @@ void ObHashJoinOp::part_rescan() for (int64_t i = 0; i < part_count_; i ++) { hj_part_array_[i].~ObHashJoinPartition(); } - alloc_->free(hj_part_array_); + if (OB_NOT_NULL(alloc_)) { + alloc_->free(hj_part_array_); + } hj_part_array_ = NULL; } if (right_hj_part_array_ != NULL) { for (int64_t i = 0; i < part_count_; i ++) { 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; } 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 ++) { part_histograms_[i].~HashJoinHistogram(); } - alloc_->free(part_histograms_); + if (OB_NOT_NULL(alloc_)) { + alloc_->free(part_histograms_); + } part_histograms_ = NULL; } if (OB_NOT_NULL(part_selectors_)) { - alloc_->free(part_selectors_); + if (OB_NOT_NULL(alloc_)) { + alloc_->free(part_selectors_); + } part_selectors_ = nullptr; part_selector_sizes_ = nullptr; }