Fix some sample logic.

This commit is contained in:
XIAO-HOU
2024-04-10 13:20:50 +00:00
committed by ob-robot
parent 664822467e
commit deb429e32e
3 changed files with 17 additions and 14 deletions

View File

@ -175,6 +175,9 @@ int ObSampleFilterExecutor::build_row_id_handle(
} else if (nullptr != index_row_id_handle_) {
MEMSET(static_cast<void *>(index_row_id_handle_), 0, sizeof(ObIndexRowIdHandle) * index_handle_max_cnt);
MEMSET(static_cast<void *>(data_row_id_handle_), 0, sizeof(int64_t) * data_handle_max_cnt);
row_id_handle_cap_ = height;
index_prefetch_depth_ = index_handle_cnt;
data_prefetch_depth_ = data_handle_cnt;
} else if (OB_ISNULL(buf = allocator_->alloc(sizeof(ObIndexRowIdHandle) * index_handle_max_cnt + sizeof(int64_t) * data_handle_max_cnt))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("Failed to alloc memory for index_row_id_handle and data_row_id_handle", K(ret), K(index_handle_max_cnt), K(data_handle_max_cnt));

View File

@ -103,7 +103,7 @@ public:
count_ = std::floor(static_cast<double>((interval_id_ + 1) * interval_length_) * percent_ / 100)
- std::floor(static_cast<double>(interval_id_ * interval_length_) * percent_ / 100);
uint64_t hash_value = murmurhash(&interval_id_, sizeof(interval_id_), static_cast<uint64_t>(seed_));
uint64_t offset = interval_length_ <= count_ ? 0 : hash_value % (interval_length_ - count_);
uint64_t offset = interval_length_ <= count_ ? 0 : hash_value % (interval_length_ - count_ + 1);
left_ = static_cast<int64_t>(interval_length_ * interval_id_ + offset) + start_;
right_ = left_ + count_ - 1;
}