github-actions[bot] commented on code in PR #38502: URL: https://github.com/apache/doris/pull/38502#discussion_r1695573549
########## be/src/io/compress/block_compression_file_wroter.cpp: ########## @@ -0,0 +1,111 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "io/compress/block_compression_file_writer.h" + +namespace doris::io { + +// TODO: split thie function +Status BlockCompressionFileWriter::appendv(const Slice* data, size_t data_cnt) { Review Comment: warning: function 'appendv' has cognitive complexity of 103 (threshold 50) [readability-function-cognitive-complexity] ```cpp Status BlockCompressionFileWriter::appendv(const Slice* data, size_t data_cnt) { ^ ``` <details> <summary>Additional context</summary> **be/src/io/compress/block_compression_file_wroter.cpp:23:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (_compressor->finished()) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:27:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp for (size_t i = 0; i < data_cnt; ++i) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:28:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (data[i].get_data() == nullptr) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:30:** +1, nesting level increased to 2 ```cpp } else if (data[i].size < 0) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:32:** +1, nesting level increased to 2 ```cpp } else if (data[i].size == 0) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:39:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (len + limit_len > _max_input_size && limit_len > 0) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:39:** +1 ```cpp if (len + limit_len > _max_input_size && limit_len > 0) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:42:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(finish()); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:42:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(finish()); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:43:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(_compressor->reset()); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:43:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(_compressor->reset()); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:46:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (len > _max_input_size) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:50:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(_write_length(len)); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:50:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(_write_length(len)); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:51:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp do { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:54:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(_compressor->set_input(buf, buf_len)); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:54:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(_compressor->set_input(buf, buf_len)); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:56:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp while (!_compressor->finished()) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:57:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(_compress()); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:57:** +6, including nesting penalty of 5, nesting level increased to 6 ```cpp RETURN_IF_ERROR(_compress()); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:59:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(_compressor->reset()); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:59:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(_compressor->reset()); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:63:** +1, nesting level increased to 2 ```cpp } else { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:64:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(_compressor->set_input(buf, len)); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:64:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(_compressor->set_input(buf, len)); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:65:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (!_compressor->need_input()) { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:68:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(_write_length(_compressor->get_bytes_read())); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:68:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(_write_length(_compressor->get_bytes_read())); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:69:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp do { ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:70:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(_compress()); ^ ``` **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/io/compress/block_compression_file_wroter.cpp:70:** +6, including nesting penalty of 5, nesting level increased to 6 ```cpp RETURN_IF_ERROR(_compress()); ^ ``` **be/src/common/status.h:620:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
