Skip to content

Commit 1c630eb

Browse files
branch-4.0: [Bug](exec) Return error is materialization_opertor not found right backend id #58470 (#59358)
Cherry-picked from #58470 Co-authored-by: HappenLee <[email protected]>
1 parent 768032e commit 1c630eb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

be/src/pipeline/exec/materialization_opertor.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void MaterializationSharedState::get_block(vectorized::Block* block) {
5555
}
5656

5757
Status MaterializationSharedState::merge_multi_response() {
58-
std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
58+
std::unordered_map<int64_t, std::pair<vectorized::Block, int>> block_maps;
5959
for (int i = 0; i < block_order_results.size(); ++i) {
6060
for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
6161
vectorized::Block partial_block;
@@ -71,14 +71,20 @@ Status MaterializationSharedState::merge_multi_response() {
7171
}
7272

7373
if (!partial_block.is_empty_column()) {
74-
_block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
74+
block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
7575
}
7676
}
7777

7878
for (int j = 0; j < block_order_results[i].size(); ++j) {
7979
auto backend_id = block_order_results[i][j];
8080
if (backend_id) {
81-
auto& source_block_rows = _block_maps[backend_id];
81+
if (UNLIKELY(block_maps.find(backend_id) == block_maps.end())) {
82+
return Status::InternalError(
83+
fmt::format("MaterializationSharedState::merge_multi_response, "
84+
"backend_id {} not found in block_maps",
85+
backend_id));
86+
}
87+
auto& source_block_rows = block_maps[backend_id];
8288
DCHECK(source_block_rows.second < source_block_rows.first.rows());
8389
for (int k = 0; k < response_blocks[i].columns(); ++k) {
8490
response_blocks[i].get_column_by_position(k)->insert_from(

0 commit comments

Comments
 (0)