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


##########
be/src/vec/exec/format/format_common.h:
##########
@@ -107,4 +107,34 @@ class KVCache {
     std::unordered_map<KType, void*> _storage;
 };
 
+class ShardedKVCache {
+public:
+    ShardedKVCache(uint32_t num_shards) : _num_shards(num_shards) {
+        _shards = new (std::nothrow) KVCache<std::string>*[_num_shards];
+        for (uint32_t i = 0; i < _num_shards; i++) {
+            _shards[i] = new KVCache<std::string>();
+        }
+    }
+
+    ~ShardedKVCache() {
+        for (uint32_t i = 0; i < _num_shards; i++) {
+            delete _shards[i];
+        }
+        delete[] _shards;
+    }
+
+    template <class T>
+    T* get(const std::string& key, const std::function<T*()> create_func) {
+        return _shards[_get_idx(key)]->get(key, create_func);
+    }
+
+private:
+    uint32_t _get_idx(const std::string& key) {

Review Comment:
   warning: method '_get_idx' can be made const 
[readability-make-member-function-const]
   
   ```suggestion
       uint32_t _get_idx(const std::string& key) const {
   ```
   



##########
be/test/vec/exec/parquet/parquet_thrift_test.cpp:
##########
@@ -87,7 +87,7 @@
     EXPECT_TRUE(st.ok());
 
     std::shared_ptr<FileMetaData> metadata;
-    parse_thrift_footer(reader, metadata);
+    parse_thrift_footer(reader, &(metadata.get()));

Review Comment:
   warning: cannot take the address of an rvalue of type 
'std::__shared_ptr<doris::vectorized::FileMetaData, 
__gnu_cxx::_S_atomic>::element_type *' (aka 'doris::vectorized::FileMetaData 
*') [clang-diagnostic-error]
   ```cpp
       parse_thrift_footer(reader, &(metadata.get()));
                                   ^
   ```
   



##########
be/test/vec/exec/parquet/parquet_thrift_test.cpp:
##########
@@ -479,7 +479,7 @@
 
     // prepare metadata
     std::shared_ptr<FileMetaData> meta_data;
-    parse_thrift_footer(file_reader, meta_data);
+    parse_thrift_footer(file_reader, &(meta_data.get()));

Review Comment:
   warning: cannot take the address of an rvalue of type 
'std::__shared_ptr<doris::vectorized::FileMetaData, 
__gnu_cxx::_S_atomic>::element_type *' (aka 'doris::vectorized::FileMetaData 
*') [clang-diagnostic-error]
   ```cpp
       parse_thrift_footer(file_reader, &(meta_data.get()));
                                        ^
   ```
   



##########
be/test/vec/exec/parquet/parquet_thrift_test.cpp:
##########
@@ -359,7 +359,7 @@
     std::unique_ptr<vectorized::Block> block;
     create_block(block);
     std::shared_ptr<FileMetaData> metadata;
-    parse_thrift_footer(reader, metadata);
+    parse_thrift_footer(reader, &(metadata.get()));

Review Comment:
   warning: cannot take the address of an rvalue of type 
'std::__shared_ptr<doris::vectorized::FileMetaData, 
__gnu_cxx::_S_atomic>::element_type *' (aka 'doris::vectorized::FileMetaData 
*') [clang-diagnostic-error]
   ```cpp
       parse_thrift_footer(reader, &(metadata.get()));
                                   ^
   ```
   



##########
be/test/vec/exec/parquet/parquet_thrift_test.cpp:
##########
@@ -55,7 +55,7 @@ TEST_F(ParquetThriftReaderTest, normal) {
     EXPECT_TRUE(st.ok());
 
     std::shared_ptr<FileMetaData> meta_data;
-    parse_thrift_footer(reader, meta_data);
+    parse_thrift_footer(reader, &(meta_data.get()));

Review Comment:
   warning: cannot take the address of an rvalue of type 
'std::__shared_ptr<doris::vectorized::FileMetaData, 
__gnu_cxx::_S_atomic>::element_type *' (aka 'doris::vectorized::FileMetaData 
*') [clang-diagnostic-error]
   ```cpp
       parse_thrift_footer(reader, &(meta_data.get()));
                                   ^
   ```
   



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