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


##########
be/src/pipeline/exec/exchange_sink_operator.cpp:
##########
@@ -148,22 +144,32 @@
                     
channel_shared_ptrs[fragment_id_to_channel_index[fragment_instance_id.lo]]);
         }
     }
-    SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get());
-
-    int local_size = 0;
     for (int i = 0; i < channels.size(); ++i) {
-        RETURN_IF_ERROR(channels[i]->init(state));
+        RETURN_IF_ERROR(channels[i]->init_stub(state));
         if (channels[i]->is_local()) {
-            local_size++;
+            _local_size++;
         }
     }
+    only_local_exchange = _local_size == channels.size();
+    _wait_for_dependency_timer = ADD_TIMER_WITH_LEVEL(_profile, 
"WaitForDependencyTime", 1);
+    _wait_queue_timer = ADD_CHILD_TIMER_WITH_LEVEL(_profile, 
"WaitForRpcBufferQueue",
+                                                   "WaitForDependencyTime", 1);
+    return Status::OK();
+}
+
+Status ExchangeSinkLocalState::open(RuntimeState* state) {

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



##########
be/src/pipeline/exec/exchange_sink_operator.cpp:
##########
@@ -148,22 +144,32 @@ Status ExchangeSinkLocalState::init(RuntimeState* state, 
LocalSinkStateInfo& inf
                     
channel_shared_ptrs[fragment_id_to_channel_index[fragment_instance_id.lo]]);
         }
     }
-    SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get());
-
-    int local_size = 0;
     for (int i = 0; i < channels.size(); ++i) {
-        RETURN_IF_ERROR(channels[i]->init(state));
+        RETURN_IF_ERROR(channels[i]->init_stub(state));
         if (channels[i]->is_local()) {
-            local_size++;
+            _local_size++;
         }
     }
+    only_local_exchange = _local_size == channels.size();
+    _wait_for_dependency_timer = ADD_TIMER_WITH_LEVEL(_profile, 
"WaitForDependencyTime", 1);
+    _wait_queue_timer = ADD_CHILD_TIMER_WITH_LEVEL(_profile, 
"WaitForRpcBufferQueue",
+                                                   "WaitForDependencyTime", 1);
+    return Status::OK();
+}
+
+Status ExchangeSinkLocalState::open(RuntimeState* state) {

Review Comment:
   warning: function 'open' has cognitive complexity of 64 (threshold 50) 
[readability-function-cognitive-complexity]
   ```cpp
   Status ExchangeSinkLocalState::open(RuntimeState* state) {
                                  ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/pipeline/exec/exchange_sink_operator.cpp:160:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       RETURN_IF_ERROR(Base::open(state));
       ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:160:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
       RETURN_IF_ERROR(Base::open(state));
       ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:166:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       if (_part_type == TPartitionType::UNPARTITIONED || _part_type == 
TPartitionType::RANDOM ||
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:184:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       if ((_part_type == TPartitionType::UNPARTITIONED || channels.size() == 
1) &&
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:191:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           for (int i = 0; i < config::num_broadcast_buffer; ++i) {
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:197:** +1, nesting level 
increased to 1
   ```cpp
       } else if (_local_size > 0) {
              ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:212:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       if (_part_type == TPartitionType::HASH_PARTITIONED) {
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:216:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->init(p._texprs));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:216:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->init(p._texprs));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:217:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:217:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:220:** +1, nesting level 
increased to 1
   ```cpp
       } else if (_part_type == 
TPartitionType::BUCKET_SHFFULE_HASH_PARTITIONED) {
              ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:224:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->init(p._texprs));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:224:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->init(p._texprs));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:225:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:225:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:228:** +1, nesting level 
increased to 1
   ```cpp
       } else if (_part_type == 
TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED) {
              ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:234:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_schema->init(p._tablet_sink_schema));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:234:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_schema->init(p._tablet_sink_schema));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:236:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_vpartition->init());
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:236:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_vpartition->init());
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:259:** +1, nesting level 
increased to 1
   ```cpp
       } else if (_part_type == TPartitionType::TABLE_SINK_HASH_PARTITIONED) {
              ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:276:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->init(p._texprs));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:276:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->init(p._texprs));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:277:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:277:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:283:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       if (_part_type == TPartitionType::HASH_PARTITIONED ||
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:286:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_partitioner->open(state));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:286:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_partitioner->open(state));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:287:** +1, nesting level 
increased to 1
   ```cpp
       } else if (_part_type == 
TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED) {
              ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:288:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(_row_distribution.open(_tablet_sink_row_desc));
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:288:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(_row_distribution.open(_tablet_sink_row_desc));
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   
   </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