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


##########
be/src/pipeline/exec/exchange_sink_operator.cpp:
##########
@@ -463,13 +560,22 @@ Status 
ExchangeSinkOperatorX::channel_add_rows(RuntimeState* state, Channels& ch
                                                int num_channels,
                                                const HashValueType* __restrict 
channel_ids,
                                                int rows, vectorized::Block* 
block, bool eos) {
-    std::vector<uint32_t> channel2rows[num_channels];
-
+    std::vector<std::vector<uint32_t>> channel2rows;
+    channel2rows.resize(num_channels);
     for (uint32_t i = 0; i < rows; i++) {
         channel2rows[channel_ids[i]].emplace_back(i);
     }
 
-    Status status;
+    RETURN_IF_ERROR(
+            channel_add_rows_with_idx(state, channels, num_channels, 
channel2rows, block, eos));
+    return Status::OK();
+}
+
+template <typename Channels>
+Status ExchangeSinkOperatorX::channel_add_rows_with_idx(

Review Comment:
   warning: function 'channel_add_rows_with_idx' has cognitive complexity of 52 
(threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   Status ExchangeSinkOperatorX::channel_add_rows_with_idx(
                                 ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/pipeline/exec/exchange_sink_operator.cpp:578:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       for (int i = 0; i < num_channels; ++i) {
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:579:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           if (!channels[i]->is_receiver_eof() && !channel2rows[i].empty()) {
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:579:** +1
   ```cpp
           if (!channels[i]->is_receiver_eof() && !channel2rows[i].empty()) {
                                               ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:581:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
               HANDLE_CHANNEL_STATUS(state, channels[i], status);
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:419:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
       do {                                                 \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:581:** +4, including 
nesting penalty of 3, nesting level increased to 4
   ```cpp
               HANDLE_CHANNEL_STATUS(state, channels[i], status);
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:420:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           if (status.is<ErrorCode::END_OF_FILE>()) {       \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:581:** +1, nesting level 
increased to 4
   ```cpp
               HANDLE_CHANNEL_STATUS(state, channels[i], status);
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:422:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           } else {                                         \
             ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:581:** +5, including 
nesting penalty of 4, nesting level increased to 5
   ```cpp
               HANDLE_CHANNEL_STATUS(state, channels[i], status);
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:423:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
               RETURN_IF_ERROR(status);                     \
               ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:581:** +6, including 
nesting penalty of 5, nesting level increased to 6
   ```cpp
               HANDLE_CHANNEL_STATUS(state, channels[i], status);
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:423:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
               RETURN_IF_ERROR(status);                     \
               ^
   ```
   **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:586:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       if (eos) {
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:587:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
           for (int i = 0; i < num_channels; ++i) {
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:588:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
               if (!channels[i]->is_receiver_eof()) {
               ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:590:** +4, including 
nesting penalty of 3, nesting level increased to 4
   ```cpp
                   HANDLE_CHANNEL_STATUS(state, channels[i], status);
                   ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:419:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
       do {                                                 \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:590:** +5, including 
nesting penalty of 4, nesting level increased to 5
   ```cpp
                   HANDLE_CHANNEL_STATUS(state, channels[i], status);
                   ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:420:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           if (status.is<ErrorCode::END_OF_FILE>()) {       \
           ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:590:** +1, nesting level 
increased to 5
   ```cpp
                   HANDLE_CHANNEL_STATUS(state, channels[i], status);
                   ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:422:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           } else {                                         \
             ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:590:** +6, including 
nesting penalty of 5, nesting level increased to 6
   ```cpp
                   HANDLE_CHANNEL_STATUS(state, channels[i], status);
                   ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:423:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
               RETURN_IF_ERROR(status);                     \
               ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/pipeline/exec/exchange_sink_operator.cpp:590:** +7, including 
nesting penalty of 6, nesting level increased to 7
   ```cpp
                   HANDLE_CHANNEL_STATUS(state, channels[i], status);
                   ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:423:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
               RETURN_IF_ERROR(status);                     \
               ^
   ```
   **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