github-actions[bot] commented on code in PR #33168: URL: https://github.com/apache/doris/pull/33168#discussion_r1549256758
########## be/src/olap/compaction.cpp: ########## @@ -449,7 +449,7 @@ Status CompactionMixin::execute_compact_impl(int64_t permits) { return Status::OK(); } -Status CompactionMixin::do_inverted_index_compaction() { +Status Compaction::do_inverted_index_compaction() { Review Comment: warning: function 'do_inverted_index_compaction' has cognitive complexity of 69 (threshold 50) [readability-function-cognitive-complexity] ```cpp Status Compaction::do_inverted_index_compaction() { ^ ``` <details> <summary>Additional context</summary> **be/src/olap/compaction.cpp:453:** +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:454:** +1 ```cpp !_stats.rowid_conversion || ctx.skip_inverted_index.empty()) { ^ ``` **be/src/olap/compaction.cpp:474:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (!_allow_delete_in_cumu_compaction) { ^ ``` **be/src/olap/compaction.cpp:475:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (compaction_type() == ReaderType::READER_CUMULATIVE_COMPACTION && ^ ``` **be/src/olap/compaction.cpp:475:** +1 ```cpp if (compaction_type() == ReaderType::READER_CUMULATIVE_COMPACTION && ^ ``` **be/src/olap/compaction.cpp:488:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp RETURN_IF_ERROR(_tablet->check_rowid_conversion(_output_rowset, location_map)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/olap/compaction.cpp:488:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(_tablet->check_rowid_conversion(_output_rowset, location_map)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/olap/compaction.cpp:505:** +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:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/olap/compaction.cpp:505:** +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:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/olap/compaction.cpp:510:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (dest_segment_num <= 0) { ^ ``` **be/src/olap/compaction.cpp:531:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp for (int i = 0; i < dest_segment_num; ++i) { ^ ``` **be/src/olap/compaction.cpp:538:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (config::debug_inverted_index_compaction) { ^ ``` **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:541:** 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:543:** 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:541:** 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:543:** 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:541:** 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:543:** 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:541:** 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:543:** 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:541:** 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:543:** 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:541:** 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:543:** 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:541:** 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:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/olap/compaction.cpp:604:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp for (int i = 0; i < dest_segment_num; ++i) { ^ ``` **be/src/olap/compaction.cpp:611:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (st.ok()) { ^ ``` **be/src/olap/compaction.cpp:617:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_NOT_OK_STATUS_WITH_WARN( ^ ``` **be/src/common/status.h:594:** expanded from macro 'RETURN_NOT_OK_STATUS_WITH_WARN' ```cpp do { \ ^ ``` **be/src/olap/compaction.cpp:617:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_NOT_OK_STATUS_WITH_WARN( ^ ``` **be/src/common/status.h:596:** expanded from macro 'RETURN_NOT_OK_STATUS_WITH_WARN' ```cpp if (UNLIKELY(!_s.ok())) { \ ^ ``` **be/src/olap/compaction.cpp:622:** +1, nesting level increased to 2 ```cpp } else if (st.is<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>()) { ^ ``` **be/src/olap/compaction.cpp:627:** +1, nesting level increased to 2 ```cpp } else { ^ ``` **be/src/olap/compaction.cpp:643:** nesting level increased to 1 ```cpp auto error_handler = [this](int64_t index_id, int64_t column_uniq_id) { ^ ``` **be/src/olap/compaction.cpp:714:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (!status.ok()) { ^ ``` </details> ########## be/src/olap/compaction.cpp: ########## @@ -449,7 +449,7 @@ return Status::OK(); } -Status CompactionMixin::do_inverted_index_compaction() { +Status Compaction::do_inverted_index_compaction() { Review Comment: warning: function 'do_inverted_index_compaction' exceeds recommended size/complexity thresholds [readability-function-size] ```cpp Status Compaction::do_inverted_index_compaction() { ^ ``` <details> <summary>Additional context</summary> **be/src/olap/compaction.cpp:451:** 275 lines including whitespace and comments (threshold 80) ```cpp Status Compaction::do_inverted_index_compaction() { ^ ``` </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