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


##########
be/src/olap/memtable.cpp:
##########
@@ -578,6 +546,200 @@ void MemTable::_aggregate() {
     }
 }
 
+template <bool is_final>
+void MemTable::_aggregate_for_flexible_partial_update_without_seq_col(
+        const vectorized::ColumnsWithTypeAndName& block_data,
+        vectorized::MutableBlock& mutable_block, std::vector<RowInBlock*>& 
temp_row_in_blocks) {
+    RowInBlock* prev_row = nullptr;
+    int row_pos = -1;
+    auto& skip_bitmaps = assert_cast<vectorized::ColumnBitmap*>(
+                                 
mutable_block.mutable_columns()[_skip_bitmap_col_idx].get())
+                                 ->get_data();
+    auto& delete_signs = assert_cast<vectorized::ColumnInt8*>(
+                                 
mutable_block.mutable_columns()[_delete_sign_col_idx].get())
+                                 ->get_data();
+    RowInBlock* row_with_delete_sign {nullptr};
+    RowInBlock* row_without_delete_sign {nullptr};
+
+    auto finalize_rows = [&]() {
+        if (row_with_delete_sign != nullptr) {
+            temp_row_in_blocks.push_back(row_with_delete_sign);
+            _finalize_one_row<is_final, false>(row_with_delete_sign, 
block_data, ++row_pos);
+            row_with_delete_sign = nullptr;
+        }
+        if (row_without_delete_sign != nullptr) {
+            temp_row_in_blocks.push_back(row_without_delete_sign);
+            _finalize_one_row<is_final, false>(row_without_delete_sign, 
block_data, ++row_pos);
+            row_without_delete_sign = nullptr;
+        }
+        _arena->clear();
+    };
+
+    auto add_row = [&](RowInBlock* row, bool with_delete_sign) {
+        if (with_delete_sign) {
+            row_with_delete_sign = row;
+        } else {
+            row_without_delete_sign = row;
+        }
+    };
+    for (RowInBlock* cur_row : _row_in_blocks) {
+        const BitmapValue& skip_bitmap = skip_bitmaps[cur_row->_row_pos];
+        bool cur_row_has_delete_sign = 
(!skip_bitmap.contains(_delete_sign_col_unique_id) &&
+                                        delete_signs[cur_row->_row_pos] != 0);
+        prev_row =
+                (row_with_delete_sign == nullptr) ? row_without_delete_sign : 
row_with_delete_sign;
+        // compare keys, the keys of row_with_delete_sign and 
row_without_delete_sign is the same,
+        // choose any of them if it's valid
+        if (prev_row != nullptr && (*_vec_row_comparator)(prev_row, cur_row) 
== 0) {
+            if (cur_row_has_delete_sign) {
+                if (row_without_delete_sign != nullptr) {
+                    // if there exits row without delete sign, remove it first
+                    _clear_row_agg(row_without_delete_sign);
+                    _stat.merged_rows++;
+                    row_without_delete_sign = nullptr;
+                }
+                // and then unconditionally replace the previous row
+                prev_row = row_with_delete_sign;
+            } else {
+                prev_row = row_without_delete_sign;
+            }
+
+            if (prev_row == nullptr) {
+                add_row(cur_row, cur_row_has_delete_sign);
+            } else {
+                if (!prev_row->has_init_agg()) {
+                    _init_row_for_agg(prev_row, mutable_block);
+                }
+                _stat.merged_rows++;
+                _aggregate_two_row_in_block<true>(mutable_block, cur_row, 
prev_row);
+            }
+        } else {
+            finalize_rows();
+            add_row(cur_row, cur_row_has_delete_sign);
+        }
+    }
+    // finalize the last lows
+    finalize_rows();
+}
+
+template <bool is_final>
+void MemTable::_aggregate_for_flexible_partial_update_with_seq_col(

Review Comment:
   warning: function '_aggregate_for_flexible_partial_update_with_seq_col' 
exceeds recommended size/complexity thresholds [readability-function-size]
   ```cpp
   void MemTable::_aggregate_for_flexible_partial_update_with_seq_col(
                  ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/memtable.cpp:625:** 113 lines including whitespace and 
comments (threshold 80)
   ```cpp
   void MemTable::_aggregate_for_flexible_partial_update_with_seq_col(
                  ^
   ```
   
   </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