Skip to content

Commit

Permalink
[Fix](vertical compaction) Preserve _segment_num_rows during final se…
Browse files Browse the repository at this point in the history
…gment flush (apache#18779)
  • Loading branch information
airborne12 authored and caiconghui1 committed Jun 21, 2023
1 parent 720d987 commit 056b7a9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions be/src/olap/rowset/vertical_beta_rowset_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ Status VerticalBetaRowsetWriter::add_columns(const vectorized::Block* block,
// segment is full, need flush columns and create new segment writer
RETURN_IF_ERROR(_flush_columns(&_segment_writers[_cur_writer_idx], true));

_segment_num_rows.resize(_cur_writer_idx + 1);
_segment_num_rows[_cur_writer_idx] = _segment_writers[_cur_writer_idx]->row_count();

std::unique_ptr<segment_v2::SegmentWriter> writer;
RETURN_IF_ERROR(_create_segment_writer(col_ids, is_key, &writer));
_segment_writers.emplace_back(std::move(writer));
Expand Down Expand Up @@ -114,6 +111,8 @@ Status VerticalBetaRowsetWriter::_flush_columns(
key_bounds.set_min_key(min_key.to_string());
key_bounds.set_max_key(max_key.to_string());
_segments_encoded_key_bounds.emplace_back(key_bounds);
_segment_num_rows.resize(_cur_writer_idx + 1);
_segment_num_rows[_cur_writer_idx] = _segment_writers[_cur_writer_idx]->row_count();
}
_total_index_size += static_cast<int64_t>(index_size);
return Status::OK();
Expand Down

0 comments on commit 056b7a9

Please sign in to comment.