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


##########
be/src/olap/compaction.cpp:
##########
@@ -482,46 +484,12 @@ 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 
74 (threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   Status Compaction::do_inverted_index_compaction() {
                      ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/compaction.cpp:485:** +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:486:** +1
   ```cpp
           !_stats.rowid_conversion || 
ctx.columns_to_do_index_compaction.empty()) {
                                    ^
   ```
   **be/src/olap/compaction.cpp:507:** +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:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:507:** +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:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:512:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (dest_segment_num <= 0) {
       ^
   ```
   **be/src/olap/compaction.cpp:522:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (config::debug_inverted_index_compaction) {
       ^
   ```
   **be/src/olap/compaction.cpp:534:** +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:539:** nesting level increased to 2
   ```cpp
           auto write_json_to_file = [&](const nlohmann::json& json_obj,
                                     ^
   ```
   **be/src/olap/compaction.cpp:544:** +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:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:544:** +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:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:545:** +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:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:545:** +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:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:546:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(file_writer->append("\n"));
               ^
   ```
   **be/src/common/status.h:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:546:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               RETURN_IF_ERROR(file_writer->append("\n"));
               ^
   ```
   **be/src/common/status.h:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:554:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:554:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:559:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:559:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:564:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:564:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:569:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:569:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(write_json_to_file(
           ^
   ```
   **be/src/common/status.h:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:621:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       for (int seg_id = 0; seg_id < dest_segment_num; ++seg_id) {
       ^
   ```
   **be/src/olap/compaction.cpp:630:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (st.ok()) {
           ^
   ```
   **be/src/olap/compaction.cpp:635:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (_cur_tablet_schema->get_inverted_index_storage_format() !=
               ^
   ```
   **be/src/olap/compaction.cpp:640:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
                   if (!st.ok()) {
                   ^
   ```
   **be/src/olap/compaction.cpp:649:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               
RETURN_IF_ERROR(inverted_index_file_writer->initialize(index_not_need_to_compact));
               ^
   ```
   **be/src/common/status.h:629:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/compaction.cpp:649:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               
RETURN_IF_ERROR(inverted_index_file_writer->initialize(index_not_need_to_compact));
               ^
   ```
   **be/src/common/status.h:631:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/compaction.cpp:651:** +1, nesting level increased to 2
   ```cpp
           } else if (st.is<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>()) {
                  ^
   ```
   **be/src/olap/compaction.cpp:658:** +1, nesting level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/olap/compaction.cpp:675:** nesting level increased to 1
   ```cpp
       auto error_handler = [this](int64_t index_id, int64_t column_uniq_id) {
                            ^
   ```
   **be/src/olap/compaction.cpp:742:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       for (int seg_id = 0; seg_id < dest_segment_num; ++seg_id) {
       ^
   ```
   **be/src/olap/compaction.cpp:744:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (Status st = inverted_index_file_writer->close(); !st.ok()) {
           ^
   ```
   **be/src/olap/compaction.cpp:746:** +1, nesting level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/olap/compaction.cpp:753:** +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