@@ -58,6 +58,11 @@ Status PartitionedHashJoinProbeLocalState::init(RuntimeState* state, LocalStateI
58
58
" HashJoinProbeSpillDependency" , true );
59
59
state->get_task ()->add_spill_dependency (_spill_dependency.get ());
60
60
61
+ init_counters ();
62
+ return Status::OK ();
63
+ }
64
+
65
+ void PartitionedHashJoinProbeLocalState::init_counters () {
61
66
_partition_timer = ADD_TIMER (profile (), " SpillPartitionTime" );
62
67
_partition_shuffle_timer = ADD_TIMER (profile (), " SpillPartitionShuffleTime" );
63
68
_spill_build_rows = ADD_COUNTER (profile (), " SpillBuildRows" , TUnit::UNIT);
@@ -78,7 +83,6 @@ Status PartitionedHashJoinProbeLocalState::init(RuntimeState* state, LocalStateI
78
83
ADD_COUNTER_WITH_LEVEL (profile (), " ProbeBloksBytesInMem" , TUnit::BYTES, 1 );
79
84
_memory_usage_reserved =
80
85
ADD_COUNTER_WITH_LEVEL (profile (), " MemoryUsageReserved" , TUnit::BYTES, 1 );
81
- return Status::OK ();
82
86
}
83
87
84
88
#define UPDATE_COUNTER_FROM_INNER (name ) \
@@ -417,7 +421,7 @@ Status PartitionedHashJoinProbeLocalState::recover_probe_blocks_from_disk(Runtim
417
421
st = spilled_stream->read_next_block_sync (&block, &eos);
418
422
if (!st.ok ()) {
419
423
break ;
420
- } else {
424
+ } else if (!block. empty ()) {
421
425
COUNTER_UPDATE (_recovery_probe_rows, block.rows ());
422
426
COUNTER_UPDATE (_recovery_probe_blocks, 1 );
423
427
read_size += block.allocated_bytes ();
@@ -786,7 +790,7 @@ size_t PartitionedHashJoinProbeOperatorX::_revocable_mem_size(RuntimeState* stat
786
790
size_t PartitionedHashJoinProbeOperatorX::get_reserve_mem_size (RuntimeState* state) {
787
791
auto & local_state = get_local_state (state);
788
792
const auto need_to_spill = local_state._shared_state ->need_to_spill ;
789
- if (!need_to_spill || ! local_state._child_eos ) {
793
+ if (!need_to_spill || local_state._child_eos ) {
790
794
return Base::get_reserve_mem_size (state);
791
795
}
792
796
0 commit comments