Skip to content

Commit

Permalink
[Opt](SegmentIterator) clear and release iterators memory footprint i…
Browse files Browse the repository at this point in the history
…n advance when EOF
  • Loading branch information
eldenmoon committed Nov 29, 2024
1 parent bc67fc9 commit d5e2268
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,12 @@ Status SegmentIterator::copy_column_data_by_selector(vectorized::IColumn* input_
return input_col_ptr->filter_by_selector(sel_rowid_idx, select_size, output_col);
}

void SegmentIterator::_clear_iterators() {
_column_iterators.clear();
_bitmap_index_iterators.clear();
_inverted_index_iterators.clear();
}

Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
bool is_mem_reuse = block->mem_reuse();
DCHECK(is_mem_reuse);
Expand Down Expand Up @@ -2104,6 +2110,8 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
}
}
block->clear_column_data();
// clear and release iterators memory footprint in advance
_clear_iterators();
return Status::EndOfFile("no more data in segment");
}

Expand Down
2 changes: 2 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ class SegmentIterator : public RowwiseIterator {

void _calculate_expr_in_remaining_conjunct_root();

void _clear_iterators();

class BitmapRangeIterator;
class BackwardBitmapRangeIterator;

Expand Down

0 comments on commit d5e2268

Please sign in to comment.