github-actions[bot] commented on code in PR #34960:
URL: https://github.com/apache/doris/pull/34960#discussion_r1602927606


##########
be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:
##########
@@ -153,44 +153,65 @@ Status 
PartitionedHashJoinProbeLocalState::close(RuntimeState* state) {
     return Status::OK();
 }
 
-Status PartitionedHashJoinProbeLocalState::spill_build_block(RuntimeState* 
state,
-                                                             uint32_t 
partition_index) {
-    auto& partitioned_build_blocks = _shared_state->partitioned_build_blocks;
-    auto& mutable_block = partitioned_build_blocks[partition_index];
-    if (!mutable_block ||
-        mutable_block->allocated_bytes() < 
vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) {
-        --_spilling_task_count;
-        return Status::OK();
-    }
-
-    auto& build_spilling_stream = 
_shared_state->spilled_streams[partition_index];
-    if (!build_spilling_stream) {
-        
RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
-                state, build_spilling_stream, print_id(state->query_id()), 
"hash_build_sink",
-                _parent->id(), std::numeric_limits<int32_t>::max(),
-                std::numeric_limits<size_t>::max(), _runtime_profile.get()));
-        RETURN_IF_ERROR(build_spilling_stream->prepare_spill());
-        
build_spilling_stream->set_write_counters(_spill_serialize_block_timer, 
_spill_block_count,
-                                                  _spill_data_size, 
_spill_write_disk_timer,
-                                                  _spill_write_wait_io_timer);
-    }
-
+Status PartitionedHashJoinProbeLocalState::spill_probe_blocks(RuntimeState* 
state) {

Review Comment:
   warning: function 'spill_probe_blocks' has cognitive complexity of 59 
(threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   Status PartitionedHashJoinProbeLocalState::spill_probe_blocks(RuntimeState* 
state) {
                                              ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:169:** 
nesting level increased to 1
   ```cpp
       auto spill_func = [query_id, mem_tracker, state, submit_timer, this] {
                         ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:175:** +2, 
including nesting penalty of 1, nesting level increased to 2
   ```cpp
           for (uint32_t partition_index = 0; partition_index != 
p._partition_count;
           ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:179:** +3, 
including nesting penalty of 2, nesting level increased to 3
   ```cpp
               if (partitioned_block && partitioned_block->allocated_bytes() >=
               ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:179:** +1
   ```cpp
               if (partitioned_block && partitioned_block->allocated_bytes() >=
                                     ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:186:** +3, 
including nesting penalty of 2, nesting level increased to 3
   ```cpp
               if (!spilling_stream) {
               ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:187:** +4, 
including nesting penalty of 3, nesting level increased to 4
   ```cpp
                   
RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
                   ^
   ```
   **be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:187:** +5, 
including nesting penalty of 4, nesting level increased to 5
   ```cpp
                   
RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
                   ^
   ```
   **be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:191:** +4, 
including nesting penalty of 3, nesting level increased to 4
   ```cpp
                   RETURN_IF_ERROR(spilling_stream->prepare_spill());
                   ^
   ```
   **be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:191:** +5, 
including nesting penalty of 4, nesting level increased to 5
   ```cpp
                   RETURN_IF_ERROR(spilling_stream->prepare_spill());
                   ^
   ```
   **be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:198:** +3, 
including nesting penalty of 2, nesting level increased to 3
   ```cpp
               while (!blocks.empty() && !state->is_cancelled()) {
               ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:198:** +1
   ```cpp
               while (!blocks.empty() && !state->is_cancelled()) {
                                      ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:201:** +4, 
including nesting penalty of 3, nesting level increased to 4
   ```cpp
                   RETURN_IF_ERROR(spilling_stream->spill_block(state, block, 
false));
                   ^
   ```
   **be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:201:** +5, 
including nesting penalty of 4, nesting level increased to 5
   ```cpp
                   RETURN_IF_ERROR(spilling_stream->spill_block(state, block, 
false));
                   ^
   ```
   **be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:212:** 
nesting level increased to 1
   ```cpp
       auto exception_catch_func = [query_id, shared_state_holder, 
execution_context, spill_func,
                                   ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:216:** +2, 
including nesting penalty of 1, nesting level increased to 2
   ```cpp
           if (shared_state_sptr) {
           ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:219:** +2, 
including nesting penalty of 1, nesting level increased to 2
   ```cpp
           if (!shared_state_sptr || !execution_context_lock) {
           ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:219:** +1
   ```cpp
           if (!shared_state_sptr || !execution_context_lock) {
                                  ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:225:** 
nesting level increased to 2
   ```cpp
           auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return 
spill_func(); }); }();
                         ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:225:** +3, 
including nesting penalty of 2, nesting level increased to 3
   ```cpp
           auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return 
spill_func(); }); }();
                                 ^
   ```
   **be/src/common/exception.h:89:** expanded from macro 
'RETURN_IF_CATCH_EXCEPTION'
   ```cpp
       do {                                                                     
                    \
       ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:225:** +4, 
including nesting penalty of 3, nesting level increased to 4
   ```cpp
           auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return 
spill_func(); }); }();
                                 ^
   ```
   **be/src/common/exception.h:94:** expanded from macro 
'RETURN_IF_CATCH_EXCEPTION'
   ```cpp
           } catch (const doris::Exception& e) {                                
                    \
             ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:225:** +5, 
including nesting penalty of 4, nesting level increased to 5
   ```cpp
           auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return 
spill_func(); }); }();
                                 ^
   ```
   **be/src/common/exception.h:95:** expanded from macro 
'RETURN_IF_CATCH_EXCEPTION'
   ```cpp
               if (e.code() == doris::ErrorCode::MEM_ALLOC_FAILED) {            
                    \
               ^
   ```
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:227:** +2, 
including nesting penalty of 1, nesting level increased to 2
   ```cpp
           if (!status.ok()) {
           ^
   ```
   
   </details>
   



##########
be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:
##########
@@ -153,44 +153,65 @@
     return Status::OK();
 }
 
-Status PartitionedHashJoinProbeLocalState::spill_build_block(RuntimeState* 
state,
-                                                             uint32_t 
partition_index) {
-    auto& partitioned_build_blocks = _shared_state->partitioned_build_blocks;
-    auto& mutable_block = partitioned_build_blocks[partition_index];
-    if (!mutable_block ||
-        mutable_block->allocated_bytes() < 
vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) {
-        --_spilling_task_count;
-        return Status::OK();
-    }
-
-    auto& build_spilling_stream = 
_shared_state->spilled_streams[partition_index];
-    if (!build_spilling_stream) {
-        
RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
-                state, build_spilling_stream, print_id(state->query_id()), 
"hash_build_sink",
-                _parent->id(), std::numeric_limits<int32_t>::max(),
-                std::numeric_limits<size_t>::max(), _runtime_profile.get()));
-        RETURN_IF_ERROR(build_spilling_stream->prepare_spill());
-        
build_spilling_stream->set_write_counters(_spill_serialize_block_timer, 
_spill_block_count,
-                                                  _spill_data_size, 
_spill_write_disk_timer,
-                                                  _spill_write_wait_io_timer);
-    }
-
+Status PartitionedHashJoinProbeLocalState::spill_probe_blocks(RuntimeState* 
state) {

Review Comment:
   warning: function 'spill_probe_blocks' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
   Status PartitionedHashJoinProbeLocalState::spill_probe_blocks(RuntimeState* 
state) {
                                              ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp:155:** 81 
lines including whitespace and comments (threshold 80)
   ```cpp
   Status PartitionedHashJoinProbeLocalState::spill_probe_blocks(RuntimeState* 
state) {
                                              ^
   ```
   
   </details>
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to