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


##########
be/src/olap/compaction.cpp:
##########
@@ -495,10 +495,35 @@ Status CompactionMixin::execute_compact_impl(int64_t 
permits) {
 Status Compaction::do_inverted_index_compaction() {

Review Comment:
   warning: function 'do_inverted_index_compaction' has cognitive complexity of 
59 (threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   Status Compaction::do_inverted_index_compaction() {
                      ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/compaction.cpp:496:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (!config::inverted_index_compaction_enable || _input_row_num <= 0 ||
       ^
   ```
   **be/src/olap/compaction.cpp:496:** +1
   ```cpp
       if (!config::inverted_index_compaction_enable || _input_row_num <= 0 ||
                                                                            ^
   ```
   **be/src/olap/compaction.cpp:501:** nesting level increased to 1
   ```cpp
       auto error_handler = [this](int64_t index_id, int64_t column_uniq_id) {
                            ^
   ```
   **be/src/olap/compaction.cpp:513:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       
DBUG_EXECUTE_IF("Compaction::do_inverted_index_compaction_rowid_conversion_null",
       ^
   ```
   **be/src/util/debug_points.h:36:** expanded from macro 'DBUG_EXECUTE_IF'
   ```cpp
       if (UNLIKELY(config::enable_debug_points)) {                             
 \
       ^
   ```
   **be/src/olap/compaction.cpp:513:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
       
DBUG_EXECUTE_IF("Compaction::do_inverted_index_compaction_rowid_conversion_null",
       ^
   ```
   **be/src/util/debug_points.h:38:** expanded from macro 'DBUG_EXECUTE_IF'
   ```cpp
           if (dp) {                                                            
 \
           ^
   ```
   **be/src/olap/compaction.cpp:515:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (!_stats.rowid_conversion) {
       ^
   ```
   **be/src/olap/compaction.cpp:543:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       
RETURN_IF_ERROR(_output_rs_writer->get_segment_num_rows(&dest_segment_num_rows));
       ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:543:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
       
RETURN_IF_ERROR(_output_rs_writer->get_segment_num_rows(&dest_segment_num_rows));
       ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:549:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (dest_segment_num <= 0) {
       ^
   ```
   **be/src/olap/compaction.cpp:558:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (config::debug_inverted_index_compaction) {
       ^
   ```
   **be/src/olap/compaction.cpp:570:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           for (int i = 0; i < dest_segment_num; ++i) {
           ^
   ```
   **be/src/olap/compaction.cpp:575:** nesting level increased to 2
   ```cpp
           auto write_json_to_file = [&](const nlohmann::json& json_obj,
                                     ^
   ```
   **be/src/olap/compaction.cpp:580:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               
RETURN_IF_ERROR(io::global_local_filesystem()->create_file(file_path, 
&file_writer));
               ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:580:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               
RETURN_IF_ERROR(io::global_local_filesystem()->create_file(file_path, 
&file_writer));
               ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:581:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(file_writer->append(json_obj.dump()));
               ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:581:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               RETURN_IF_ERROR(file_writer->append(json_obj.dump()));
               ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:582:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(file_writer->append("\n"));
               ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:582:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               RETURN_IF_ERROR(file_writer->append("\n"));
               ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:590:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:590:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:595:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:595:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:600:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:600:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:605:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:632:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:605:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:634:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:689:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       DBUG_EXECUTE_IF(
       ^
   ```
   **be/src/util/debug_points.h:36:** expanded from macro 'DBUG_EXECUTE_IF'
   ```cpp
       if (UNLIKELY(config::enable_debug_points)) {                             
 \
       ^
   ```
   **be/src/olap/compaction.cpp:689:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
       DBUG_EXECUTE_IF(
       ^
   ```
   **be/src/util/debug_points.h:38:** expanded from macro 'DBUG_EXECUTE_IF'
   ```cpp
           if (dp) {                                                            
 \
           ^
   ```
   **be/src/olap/compaction.cpp:692:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (inverted_index_file_writers.size() != dest_segment_num) {
       ^
   ```
   **be/src/olap/compaction.cpp:780:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (!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