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


##########
be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:
##########
@@ -146,26 +143,23 @@ struct WindowFunnelState {
     }
 
     void sort() {
-        if (sorted) {
-            return;
-        }
-
         Block tmp_block = mutable_block.to_block();
         auto block = tmp_block.clone_without_columns();
         sort_block(tmp_block, block, sort_description, 0);
-        mutable_block = MutableBlock(std::move(block));
-        sorted = true;
+        mutable_block = std::move(block);
+        _reset_columns_ptr();
     }
 
     template <WindowFunnelMode WINDOW_FUNNEL_MODE>
-    int _match_event_list(size_t& start_row, size_t row_count,
-                          const NativeType* timestamp_data) const {
+    int _match_event_list(size_t& start_row, size_t row_count) const {

Review Comment:
   warning: function '_match_event_list' has cognitive complexity of 64 
(threshold 50) [readability-function-cognitive-complexity]
   ```cpp
       int _match_event_list(size_t& start_row, size_t row_count) const {
           ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:167:** 
+1, including nesting penalty of 0, nesting level increased to 1
   ```cpp
           if (match_row < row_count) {
           ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:177:** 
+2, including nesting penalty of 1, nesting level increased to 2
   ```cpp
               for (; column_idx < event_count + 1 && match_row < row_count;
               ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:177:** +1
   ```cpp
               for (; column_idx < event_count + 1 && match_row < row_count;
                                                   ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:182:** 
+3, including nesting penalty of 2, nesting level increased to 3
   ```cpp
                   if constexpr (WINDOW_FUNNEL_MODE == WindowFunnelMode::FIXED) 
{
                   ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:183:** 
+4, including nesting penalty of 3, nesting level increased to 4
   ```cpp
                       if (event_data[match_row] == 1) {
                       ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:186:** 
+5, including nesting penalty of 4, nesting level increased to 5
   ```cpp
                           if (current_timestamp <= end_timestamp) {
                           ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:194:** 
+3, including nesting penalty of 2, nesting level increased to 3
   ```cpp
                   if (match_row < row_count) {
                   ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:198:** 
+4, including nesting penalty of 3, nesting level increased to 4
   ```cpp
                       if (is_matched) {
                       ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:199:** 
+5, including nesting penalty of 4, nesting level increased to 5
   ```cpp
                           if constexpr (WINDOW_FUNNEL_MODE == 
WindowFunnelMode::INCREASE) {
                           ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:203:** 
+4, including nesting penalty of 3, nesting level increased to 4
   ```cpp
                       if (!is_matched) {
                       ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:206:** 
+4, including nesting penalty of 3, nesting level increased to 4
   ```cpp
                       if constexpr (WINDOW_FUNNEL_MODE == 
WindowFunnelMode::INCREASE) {
                       ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:210:** 
+4, including nesting penalty of 3, nesting level increased to 4
   ```cpp
                       if constexpr (WINDOW_FUNNEL_MODE == 
WindowFunnelMode::DEDUPLICATION) {
                       ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:212:** 
+5, including nesting penalty of 4, nesting level increased to 5
   ```cpp
                           if (match_row != last_match_row + 1) {
                           ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:213:** 
+6, including nesting penalty of 5, nesting level increased to 6
   ```cpp
                               for (int tmp_column_idx = 1; tmp_column_idx < 
column_idx;
                               ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:222:** 
+7, including nesting penalty of 6, nesting level increased to 7
   ```cpp
                                   if (dup_match_row < match_row) {
                                   ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:228:** 
+5, including nesting penalty of 4, nesting level increased to 5
   ```cpp
                           if (is_dup) {
                           ^
   ```
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:234:** 
+1, nesting level increased to 3
   ```cpp
                   } else {
                     ^
   ```
   
   </details>
   



##########
be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:
##########
@@ -146,26 +143,23 @@
     }
 
     void sort() {
-        if (sorted) {
-            return;
-        }
-
         Block tmp_block = mutable_block.to_block();
         auto block = tmp_block.clone_without_columns();
         sort_block(tmp_block, block, sort_description, 0);
-        mutable_block = MutableBlock(std::move(block));
-        sorted = true;
+        mutable_block = std::move(block);
+        _reset_columns_ptr();
     }
 
     template <WindowFunnelMode WINDOW_FUNNEL_MODE>
-    int _match_event_list(size_t& start_row, size_t row_count,
-                          const NativeType* timestamp_data) const {
+    int _match_event_list(size_t& start_row, size_t row_count) const {

Review Comment:
   warning: function '_match_event_list' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
       int _match_event_list(size_t& start_row, size_t row_count) const {
           ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:153:** 
87 lines including whitespace and comments (threshold 80)
   ```cpp
       int _match_event_list(size_t& start_row, size_t row_count) const {
           ^
   ```
   
   </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