Skip to content

Commit

Permalink
Fix empty range problem
Browse files Browse the repository at this point in the history
  • Loading branch information
stdpain committed Sep 12, 2023
1 parent 6eaab1c commit 208e5dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion be/src/storage/range.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,14 @@ inline std::string SparseRange::to_string() const {
}

inline void SparseRange::split(size_t expected_range_cnt) {
if (size() < expected_range_cnt) {
if (size() < expected_range_cnt && span_size() > expected_range_cnt) {
size_t expected_size_each_range = 0;
// 4096 + 65535 / 10 = expected_size;
for (size_t i = 0; i < size(); ++i) {
expected_size_each_range += _ranges[i].span_size();
}
expected_size_each_range /= expected_range_cnt;
expected_size_each_range = std::max(expected_size_each_range, 1);
std::vector<Range> new_ranges;
for (auto range : _ranges) {
while (range.span_size() > expected_size_each_range) {
Expand Down

0 comments on commit 208e5dc

Please sign in to comment.