Skip to content

Commit

Permalink
[Fix](segment iterator) fix shrink non-char column coredump
Browse files Browse the repository at this point in the history
  • Loading branch information
airborne12 committed Jun 13, 2024
1 parent ac2bf56 commit fd35133
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,6 +2327,7 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
RETURN_IF_ERROR(_convert_to_expected_type(_first_read_column_ids));
RETURN_IF_ERROR(_convert_to_expected_type(_non_predicate_columns));
_output_non_pred_columns(block);
block->shrink_char_type_column_suffix_zero(_char_type_idx_no_0);
if (!_enable_common_expr_pushdown || !_remaining_conjunct_roots.empty()) {
_output_index_result_column(nullptr, 0, block);
}
Expand Down Expand Up @@ -2386,14 +2387,14 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
auto col_const = vectorized::ColumnConst::create(std::move(res_column),
selected_size);
block->replace_by_position(0, std::move(col_const));
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
block->shrink_char_type_column_suffix_zero(_char_type_idx_no_0);
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
RETURN_IF_ERROR(
_execute_common_expr(_sel_rowid_idx.data(), selected_size, block));
block->replace_by_position(0, std::move(col0));
} else {
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
block->shrink_char_type_column_suffix_zero(_char_type_idx);
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
RETURN_IF_ERROR(
_execute_common_expr(_sel_rowid_idx.data(), selected_size, block));
}
Expand Down Expand Up @@ -2425,13 +2426,13 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
auto col_const =
vectorized::ColumnConst::create(std::move(res_column), selected_size);
block->replace_by_position(0, std::move(col_const));
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
block->shrink_char_type_column_suffix_zero(_char_type_idx_no_0);
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
RETURN_IF_ERROR(_execute_common_expr(_sel_rowid_idx.data(), selected_size, block));
block->replace_by_position(0, std::move(col0));
} else {
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
block->shrink_char_type_column_suffix_zero(_char_type_idx);
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
RETURN_IF_ERROR(_execute_common_expr(_sel_rowid_idx.data(), selected_size, block));
}
}
Expand All @@ -2442,9 +2443,10 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
}

if (_non_predicate_columns.empty()) {
// shrink char_type suffix zero data
block->shrink_char_type_column_suffix_zero(_char_type_idx);

if (!_is_need_expr_eval) {
block->shrink_char_type_column_suffix_zero(_char_type_idx);
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
}
return Status::OK();
}
// step4: read non_predicate column
Expand All @@ -2463,13 +2465,11 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
_output_non_pred_columns(block);

if (!_is_need_expr_eval) {
block->shrink_char_type_column_suffix_zero(_char_type_idx);
_output_index_result_column(_sel_rowid_idx.data(), selected_size, block);
}
}

// shrink char_type suffix zero data
block->shrink_char_type_column_suffix_zero(_char_type_idx);

#ifndef NDEBUG
size_t rows = block->rows();
for (const auto& entry : *block) {
Expand Down

0 comments on commit fd35133

Please sign in to comment.