From 0b856158b6bd73669aedf15c0b68b0262f010ac2 Mon Sep 17 00:00:00 2001 From: Jerry Hu Date: Mon, 11 Sep 2023 10:39:05 +0800 Subject: [PATCH] [fix](join) avoid DCHECK failed in '_filter_data_and_build_output' --- be/src/vec/exec/join/vhash_join_node.cpp | 12 +++++++++--- be/src/vec/exec/join/vhash_join_node.h | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/be/src/vec/exec/join/vhash_join_node.cpp b/be/src/vec/exec/join/vhash_join_node.cpp index cdd2c72c17f667..91bf7f477b10a4 100644 --- a/be/src/vec/exec/join/vhash_join_node.cpp +++ b/be/src/vec/exec/join/vhash_join_node.cpp @@ -524,7 +524,11 @@ Status HashJoinNode::pull(doris::RuntimeState* state, vectorized::Block* output_ ->get_data() .resize_fill(block_rows, 1); } - RETURN_IF_ERROR(_filter_data_and_build_output(state, output_block, eos, &temp_block)); + + /// No need to check the block size in `_filter_data_and_build_output` because here dose not + /// increase the output rows count(just same as `_probe_block`'s rows count). + RETURN_IF_ERROR( + _filter_data_and_build_output(state, output_block, eos, &temp_block, false)); temp_block.clear(); release_block_memory(_probe_block); return Status::OK(); @@ -612,12 +616,14 @@ Status HashJoinNode::pull(doris::RuntimeState* state, vectorized::Block* output_ Status HashJoinNode::_filter_data_and_build_output(RuntimeState* state, vectorized::Block* output_block, bool* eos, - Block* temp_block) { + Block* temp_block, bool check_rows_count) { if (_is_outer_join) { _add_tuple_is_null_column(temp_block); } auto output_rows = temp_block->rows(); - DCHECK(output_rows <= state->batch_size()); + if (check_rows_count) { // If the join node does not increase the number of output rows, no need to check. + DCHECK(output_rows <= state->batch_size()); + } { SCOPED_TIMER(_join_filter_timer); RETURN_IF_ERROR(VExprContext::filter_block(_conjuncts, temp_block, temp_block->columns())); diff --git a/be/src/vec/exec/join/vhash_join_node.h b/be/src/vec/exec/join/vhash_join_node.h index c57d11392b584f..b09f5efe3c36bf 100644 --- a/be/src/vec/exec/join/vhash_join_node.h +++ b/be/src/vec/exec/join/vhash_join_node.h @@ -703,7 +703,8 @@ class HashJoinNode final : public VJoinNodeBase { void _add_tuple_is_null_column(Block* block) override; Status _filter_data_and_build_output(RuntimeState* state, vectorized::Block* output_block, - bool* eos, Block* temp_block); + bool* eos, Block* temp_block, + bool check_rows_count = true); template friend struct ProcessHashTableBuild;