Fix some hash distinct bug for vec2.0

This commit is contained in:
obdev
2024-02-09 04:47:50 +00:00
committed by ob-robot
parent 96e64cbd47
commit 748f33d484
4 changed files with 11 additions and 7 deletions

View File

@ -557,9 +557,14 @@ int ObExtendHashTableVec<GroupRowBucket>::set_distinct_batch(const RowMeta &row_
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
new_row_selector_cnt_ = 0; new_row_selector_cnt_ = 0;
if (auto_extend_ && OB_UNLIKELY((size_ + batch_size) * SIZE_BUCKET_SCALE >= get_bucket_num())) { while (OB_SUCC(ret) && auto_extend_ && OB_UNLIKELY((size_ + batch_size)
* SIZE_BUCKET_SCALE >= get_bucket_num())) {
int64_t pre_bkt_num = get_bucket_num();
if (OB_FAIL(extend())) { if (OB_FAIL(extend())) {
SQL_ENG_LOG(WARN, "extend failed", K(ret)); SQL_ENG_LOG(WARN, "extend failed", K(ret));
} else if (get_bucket_num() <= pre_bkt_num) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("failed to extend table", K(ret), K(pre_bkt_num), K(get_bucket_num()));
} }
} }
if (OB_SUCC(ret) && OB_ISNULL(locate_buckets_)) { if (OB_SUCC(ret) && OB_ISNULL(locate_buckets_)) {

View File

@ -1042,7 +1042,7 @@ int ObExtendHashTableVec<GroupRowBucket>::get(const RowMeta &row_meta,
if (bucket->is_valid()) { if (bucket->is_valid()) {
RowItemType *it = &(bucket->get_item()); RowItemType *it = &(bucket->get_item());
while (OB_SUCC(ret) && nullptr != it) { while (OB_SUCC(ret) && nullptr != it) {
if (OB_FAIL(likely_equal(row_meta, static_cast<ObCompactRow&>(*it), batch_idx, result))) { if (OB_FAIL(likely_equal_nullable(row_meta, static_cast<ObCompactRow&>(*it), batch_idx, result))) {
LOG_WARN("failed to cmp", K(ret)); LOG_WARN("failed to cmp", K(ret));
} else if (result) { } else if (result) {
item = it; item = it;

View File

@ -1286,13 +1286,12 @@ int64_t ObHashPartInfrastructureVecImpl::est_bucket_count(
const int64_t min_bucket_cnt, const int64_t min_bucket_cnt,
const int64_t max_bucket_cnt) const int64_t max_bucket_cnt)
{ {
int64_t est_bucket_cnt = 0;
HP_INFRAS_STATUS_CHECK HP_INFRAS_STATUS_CHECK
{ {
if (OB_FAIL(hp_infras_->est_bucket_count(rows, width, min_bucket_cnt, max_bucket_cnt))) { est_bucket_cnt = hp_infras_->est_bucket_count(rows, width, min_bucket_cnt, max_bucket_cnt);
LOG_WARN("failed to est bucket count", K(ret));
} }
} return est_bucket_cnt;
return ret;
} }
int ObHashPartInfrastructureVecImpl::set_funcs( int ObHashPartInfrastructureVecImpl::set_funcs(

View File

@ -659,7 +659,7 @@ OB_INLINE int ObBitVectorImpl<WordType>::inner_foreach(const ObBitVectorImpl<Wor
if (tmp_step + step_size > size) { if (tmp_step + step_size > size) {
mini_cnt = size - tmp_step; mini_cnt = size - tmp_step;
} }
for (int64_t j = 0; j < mini_cnt; j++) { for (int64_t j = 0; OB_SUCC(ret) && j < mini_cnt; j++) {
int64_t k = j + tmp_step; int64_t k = j + tmp_step;
ret = op(k); ret = op(k);
} }