This is an automated email from the ASF dual-hosted git repository.

caiconghui pushed a commit to branch 1.2-block-fix
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 606a412b61ac8d915f2e9aebc1c7a0e9d8c24f15
Author: caiconghui1 <caicongh...@jd.com>
AuthorDate: Fri Dec 22 12:09:41 2023 +0800

    [fix](block) fix be core while mutable block merge may cause different row 
size between columns in origin block
---
 be/src/vec/exec/scan/scanner_scheduler.cpp |  4 +++-
 be/src/vec/exec/vunion_node.cpp            | 11 +++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/be/src/vec/exec/scan/scanner_scheduler.cpp 
b/be/src/vec/exec/scan/scanner_scheduler.cpp
index 7b7e3aeac50..32cefe6e822 100644
--- a/be/src/vec/exec/scan/scanner_scheduler.cpp
+++ b/be/src/vec/exec/scan/scanner_scheduler.cpp
@@ -269,7 +269,9 @@ void ScannerScheduler::_scanner_scan(ScannerScheduler* 
scheduler, ScannerContext
             ctx->return_free_block(block);
         } else {
             if (!blocks.empty() && blocks.back()->rows() + block->rows() <= 
state->batch_size()) {
-                vectorized::MutableBlock(blocks.back()).merge(*block);
+                vectorized::MutableBlock mutable_block(blocks.back());
+                mutable_block.merge(*block);
+                
blocks.back()->set_columns(std::move(mutable_block.mutable_columns()));
                 ctx->return_free_block(block);
             } else {
                 blocks.push_back(block);
diff --git a/be/src/vec/exec/vunion_node.cpp b/be/src/vec/exec/vunion_node.cpp
index 8afe5bce8df..199782b577b 100644
--- a/be/src/vec/exec/vunion_node.cpp
+++ b/be/src/vec/exec/vunion_node.cpp
@@ -171,9 +171,9 @@ Status VUnionNode::get_next_materialized(RuntimeState* 
state, Block* block) {
         }
     }
 
-    if (!mem_reuse) {
-        block->swap(mblock.to_block());
-    }
+
+    block->swap(mblock.to_block());
+
 
     DCHECK_LE(_child_idx, _children.size());
     return Status::OK();
@@ -204,9 +204,8 @@ Status VUnionNode::get_next_const(RuntimeState* state, 
Block* block) {
         }
     }
 
-    if (!mem_reuse) {
-        block->swap(mblock.to_block());
-    }
+
+    block->swap(mblock.to_block());
 
     // some insert query like "insert into string_test select 1, repeat('a', 
1024 * 1024);"
     // the const expr will be in output expr cause the union node return a 
empty block. so here we


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to