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


##########
be/src/olap/check_primary_keys_executor.h:
##########
@@ -0,0 +1,74 @@
+// 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.
+
+#pragma once
+
+#include <memory>
+#include <shared_mutex>
+#include <unordered_map>
+#include <vector>
+
+#include "common/status.h"
+#include "olap/rowset/rowset.h"
+#include "olap/rowset/segment_v2/segment_writer.h"
+#include "olap/tablet_meta.h"
+#include "util/threadpool.h"
+#include "vec/olap/olap_data_convertor.h"
+
+namespace doris {
+
+class Tablet;
+
+class CheckPrimaryKeysToken {
+public:
+    explicit CheckPrimaryKeysToken(std::unique_ptr<ThreadPoolToken> 
thread_token)
+            : _thread_token(std::move(thread_token)), _status(Status::OK()) {}
+
+    Status submit(Tablet* tablet, const PartialUpdateReadPlan* read_plan,
+                  const std::map<RowsetId, RowsetSharedPtr>* rsid_to_rowset,
+                  std::unordered_map<uint32_t, std::string>* pk_entries, bool 
with_seq_col);
+    Status submit(Tablet* tablet, const PartialUpdateReadPlan* read_plan,
+                  const std::map<RowsetId, RowsetSharedPtr>* rsid_to_rowset,
+                  segment_v2::SegmentWriter* segment_writer,
+                  std::vector<vectorized::IOlapColumnDataAccessor*>* 
key_columns, uint32_t row_pos);
+
+    Status wait();
+
+    void cancel() { _thread_token->shutdown(); }
+
+    Status get_delete_bitmap(DeleteBitmapPtr res_bitmap);
+
+private:
+    std::unique_ptr<ThreadPoolToken> _thread_token;
+    std::shared_mutex _mutex;
+    Status _status;
+};
+
+class CheckPrimaryKeysExecutor {
+public:
+    CheckPrimaryKeysExecutor() = default;
+    ~CheckPrimaryKeysExecutor() { _thread_pool->shutdown(); }

Review Comment:
   warning: use '= default' to define a trivial destructor 
[modernize-use-equals-default]
   ```cpp
       ~CheckPrimaryKeysExecutor() { _thread_pool->shutdown(); }
       ^
   ```
   



##########
be/src/olap/rowset/segment_v2/segment_writer.cpp:
##########
@@ -402,7 +404,7 @@ Status 
SegmentWriter::append_block_with_partial_content(const vectorized::Block*
         // here row_pos = 2, num_rows = 4.
         size_t delta_pos = block_pos - row_pos;
         size_t segment_pos = segment_start_pos + delta_pos;
-        std::string key = _full_encode_keys(key_columns, delta_pos);
+        std::string key = full_encode_keys(key_columns, delta_pos);

Review Comment:
   warning: variable 'key' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
           std::string key = 0 = full_encode_keys(key_columns, delta_pos);
   ```
   



##########
be/src/olap/rowset/segment_v2/segment_writer.cpp:
##########
@@ -525,7 +535,7 @@ Status 
SegmentWriter::append_block_with_partial_content(const vectorized::Block*
                     _num_rows_written, row_pos, 
_primary_key_index_builder->num_rows());
         }
         for (size_t block_pos = row_pos; block_pos < row_pos + num_rows; 
block_pos++) {
-            std::string key = _full_encode_keys(key_columns, block_pos - 
row_pos);
+            std::string key = full_encode_keys(key_columns, block_pos - 
row_pos);

Review Comment:
   warning: variable 'key' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
               std::string key = 0 = full_encode_keys(key_columns, block_pos - 
row_pos);
   ```
   



##########
be/src/olap/rowset/segment_v2/segment_writer.cpp:
##########
@@ -713,7 +723,7 @@ Status SegmentWriter::append_block(const vectorized::Block* 
block, size_t row_po
             // create primary indexes
             std::string last_key;
             for (size_t pos = 0; pos < num_rows; pos++) {
-                std::string key = _full_encode_keys(key_columns, pos);
+                std::string key = full_encode_keys(key_columns, pos);

Review Comment:
   warning: variable 'key' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
                   std::string key = 0 = full_encode_keys(key_columns, pos);
   ```
   



-- 
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