Skip to content
Open
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
9 changes: 7 additions & 2 deletions be/src/olap/memtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void MemTable::_clear_row_agg(RowInBlock* row) {
row->remove_init_agg();
}
}

// only in `to_block` the `is_final` flag will be true, in other cases, it will be false
template <bool is_final, bool has_skip_bitmap_col>
void MemTable::_aggregate() {
SCOPED_RAW_TIMER(&_stat.agg_ns);
Expand All @@ -506,10 +506,15 @@ void MemTable::_aggregate() {
}
_stat.merged_rows++;
_aggregate_two_row_in_block<has_skip_bitmap_col>(mutable_block, cur_row, prev_row);
// Clean up aggregation state of the merged row to avoid memory leak
if (cur_row) {
_clear_row_agg(cur_row);
}
} else {
prev_row = cur_row;
if (!temp_row_in_blocks.empty()) {
// no more rows to merge for prev row, finalize it
// The rows from the previous batch of _row_in_blocks have been merged into temp_row_in_blocks,
// now call finalize to write the aggregation results into _output_mutable_block.
_finalize_one_row<is_final>(temp_row_in_blocks.back().get(), block_data,
row_pos);
}
Expand Down
Loading