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


##########
be/src/io/compress/block_compression_file_wroter.cpp:
##########
@@ -0,0 +1,113 @@
+// 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 <algorithm>
+
+#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:25:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
       if (_compressor->finished()) {
       ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:29:** +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:30:** +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:32:** +1, nesting 
level increased to 2
   ```cpp
           } else if (data[i].size < 0) {
                  ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:34:** +1, nesting 
level increased to 2
   ```cpp
           } else if (data[i].size == 0) {
                  ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:41:** +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:41:** +1
   ```cpp
           if (len + limit_len > _max_input_size && limit_len > 0) {
                                                 ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:44:** +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:44:** +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:45:** +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:45:** +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:48:** +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:52:** +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:52:** +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:53:** +3, including 
nesting penalty of 2, nesting level increased to 3
   ```cpp
               do {
               ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:56:** +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:56:** +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:58:** +4, including 
nesting penalty of 3, nesting level increased to 4
   ```cpp
                   while (!_compressor->finished()) {
                   ^
   ```
   **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(_compress());
                       ^
   ```
   **be/src/common/status.h:618:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:59:** +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:61:** +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:61:** +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:65:** +1, nesting 
level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:66:** +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:66:** +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:67:** +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:70:** +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:70:** +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:71:** +4, including 
nesting penalty of 3, nesting level increased to 4
   ```cpp
                   do {
                   ^
   ```
   **be/src/io/compress/block_compression_file_wroter.cpp:72:** +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:72:** +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]

Reply via email to