@@ -493,6 +493,7 @@ Status PartitionedHashJoinProbeOperatorX::prepare(RuntimeState* state) {
493493 // to avoid prepare _child_x twice
494494 auto child_x = std::move (_child_x);
495495 RETURN_IF_ERROR (JoinProbeOperatorX::prepare (state));
496+ RETURN_IF_ERROR (vectorized::VExpr::prepare (_output_expr_ctxs, state, *_intermediate_row_desc));
496497 RETURN_IF_ERROR (_inner_probe_operator->set_child (child_x));
497498 DCHECK (_build_side_child != nullptr );
498499 _inner_probe_operator->set_build_side_child (_build_side_child);
@@ -648,6 +649,8 @@ Status PartitionedHashJoinProbeOperatorX::pull(doris::RuntimeState* state,
648649 }
649650 }
650651
652+ const auto partition_index = local_state._partition_cursor ;
653+ auto & probe_blocks = local_state._probe_blocks [partition_index];
651654 if (local_state._need_to_setup_internal_operators ) {
652655 *eos = false ;
653656 bool has_data = false ;
@@ -659,12 +662,13 @@ Status PartitionedHashJoinProbeOperatorX::pull(doris::RuntimeState* state,
659662 }
660663 RETURN_IF_ERROR (_setup_internal_operators (local_state, state));
661664 local_state._need_to_setup_internal_operators = false ;
665+ auto & mutable_block = local_state._partitioned_blocks [partition_index];
666+ if (mutable_block && !mutable_block->empty ()) {
667+ probe_blocks.emplace_back (mutable_block->to_block ());
668+ }
662669 }
663-
664- auto partition_index = local_state._partition_cursor ;
665- bool in_mem_eos_;
670+ bool in_mem_eos = false ;
666671 auto * runtime_state = local_state._runtime_state .get ();
667- auto & probe_blocks = local_state._probe_blocks [partition_index];
668672 while (_inner_probe_operator->need_more_input_data (runtime_state)) {
669673 if (probe_blocks.empty ()) {
670674 *eos = false ;
@@ -682,14 +686,16 @@ Status PartitionedHashJoinProbeOperatorX::pull(doris::RuntimeState* state,
682686
683687 auto block = std::move (probe_blocks.back ());
684688 probe_blocks.pop_back ();
685- RETURN_IF_ERROR (_inner_probe_operator->push (runtime_state, &block, false ));
689+ if (!block.empty ()) {
690+ RETURN_IF_ERROR (_inner_probe_operator->push (runtime_state, &block, false ));
691+ }
686692 }
687693
688694 RETURN_IF_ERROR (_inner_probe_operator->pull (local_state._runtime_state .get (), output_block,
689- &in_mem_eos_ ));
695+ &in_mem_eos ));
690696
691697 *eos = false ;
692- if (in_mem_eos_ ) {
698+ if (in_mem_eos ) {
693699 local_state._partition_cursor ++;
694700 if (local_state._partition_cursor == _partition_count) {
695701 *eos = true ;
@@ -829,6 +835,10 @@ Status PartitionedHashJoinProbeOperatorX::get_block(RuntimeState* state, vectori
829835 RETURN_IF_ERROR (local_state.finish_spilling (0 ));
830836 }
831837
838+ if (local_state._child_block ->rows () == 0 && !local_state._child_eos ) {
839+ return Status::OK ();
840+ }
841+
832842 Defer defer ([&] { local_state._child_block ->clear_column_data (); });
833843 if (need_to_spill) {
834844 SCOPED_TIMER (local_state.exec_time_counter ());
0 commit comments