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


##########
be/src/vec/sink/vdata_stream_sender.h:
##########
@@ -402,12 +418,20 @@ Status VDataStreamSender::channel_add_rows(RuntimeState* 
state, Channels& channe
                                            int num_channels,
                                            const HashValueType* __restrict 
channel_ids, int rows,
                                            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);
     }
+    RETURN_IF_ERROR(
+            channel_add_rows_with_idx(state, channels, num_channels, 
channel2rows, block, eos));
+    return Status::OK();
+}
 
+template <typename Channels>
+Status VDataStreamSender::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 VDataStreamSender::channel_add_rows_with_idx(
                             ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/sink/vdata_stream_sender.h:435:** +1, including nesting penalty 
of 0, nesting level increased to 1
   ```cpp
       for (int i = 0; i < num_channels; ++i) {
       ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:436:** +2, including nesting penalty 
of 1, nesting level increased to 2
   ```cpp
           if (!channels[i]->is_receiver_eof() && !channel2rows[i].empty()) {
           ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:436:** +1
   ```cpp
           if (!channels[i]->is_receiver_eof() && !channel2rows[i].empty()) {
                                               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:438:** +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:407:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
       do {                                                 \
       ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:438:** +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:408:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           if (status.is<ErrorCode::END_OF_FILE>()) {       \
           ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:438:** +1, nesting level increased 
to 4
   ```cpp
               HANDLE_CHANNEL_STATUS(state, channels[i], status);
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:410:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           } else {                                         \
             ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:438:** +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:411:** 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/vec/sink/vdata_stream_sender.h:438:** +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:411:** 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/vec/sink/vdata_stream_sender.h:442:** +1, including nesting penalty 
of 0, nesting level increased to 1
   ```cpp
       if (eos) {
       ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:443:** +2, including nesting penalty 
of 1, nesting level increased to 2
   ```cpp
           for (int i = 0; i < num_channels; ++i) {
           ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:444:** +3, including nesting penalty 
of 2, nesting level increased to 3
   ```cpp
               if (!channels[i]->is_receiver_eof()) {
               ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:446:** +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:407:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
       do {                                                 \
       ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:446:** +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:408:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           if (status.is<ErrorCode::END_OF_FILE>()) {       \
           ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:446:** +1, nesting level increased 
to 5
   ```cpp
                   HANDLE_CHANNEL_STATUS(state, channels[i], status);
                   ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:410:** expanded from macro 
'HANDLE_CHANNEL_STATUS'
   ```cpp
           } else {                                         \
             ^
   ```
   **be/src/vec/sink/vdata_stream_sender.h:446:** +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:411:** 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/vec/sink/vdata_stream_sender.h:446:** +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:411:** 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