From 469b863f774f0155a963cddb1c020d0fcaaa0494 Mon Sep 17 00:00:00 2001 From: TengJianPing Date: Tue, 24 Mar 2026 17:10:48 +0800 Subject: [PATCH] [chore](topn) check column type before merging lazy materialization columns (#61633) ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: Check column type before merging lazy materialization columns, to avoid coredump in case of any column type mismatch. ### Release note None ### Check List (For Author) - Test - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason - Behavior changed: - [ ] No. - [ ] Yes. - Does this need documentation? - [ ] No. - [ ] Yes. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label --- be/src/pipeline/exec/materialization_opertor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/be/src/pipeline/exec/materialization_opertor.cpp b/be/src/pipeline/exec/materialization_opertor.cpp index c2030adb4aecb4..e040e35d7f6f50 100644 --- a/be/src/pipeline/exec/materialization_opertor.cpp +++ b/be/src/pipeline/exec/materialization_opertor.cpp @@ -81,6 +81,14 @@ Status MaterializationSharedState::merge_multi_response() { } } + // return error if any column in response block is not compatible with source block column + for (int k = 0; k < response_blocks[i].columns(); ++k) { + const auto& resp_col_type = response_blocks[i].get_datatype_by_position(k); + for (const auto& [_, source_block_rows] : block_maps) { + RETURN_IF_ERROR(resp_col_type->check_column( + *source_block_rows.first.get_by_position(k).column)); + } + } for (int j = 0; j < block_order_results[i].size(); ++j) { auto backend_id = block_order_results[i][j]; if (backend_id) {