Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Opt](SegmentIterator) clear and release iterators memory footprint in advance when EOF (#44768) #45734

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1990,6 +1990,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) {
// TEMP column in block is not allowed here, need to erase.
block->erase_tmp_columns();
Expand Down Expand Up @@ -2094,6 +2100,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
3 changes: 3 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ class SegmentIterator : public RowwiseIterator {
bool default_return = false);

void _calculate_expr_in_remaining_conjunct_root();

void _clear_iterators();

class BitmapRangeIterator;
class BackwardBitmapRangeIterator;

Expand Down
Loading