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


##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.cpp:
##########
@@ -584,7 +593,10 @@
     strcat(buffer, name);
 }
 
-DorisCompoundDirectory::~DorisCompoundDirectory() = default;
+DorisCompoundDirectory::~DorisCompoundDirectory() {

Review Comment:
   warning: use '= default' to define a trivial destructor 
[modernize-use-equals-default]
   ```cpp
   DorisCompoundDirectory::~DorisCompoundDirectory() {
                           ^
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.cpp:
##########
@@ -690,33 +746,66 @@
 
 bool DorisCompoundDirectory::openInput(const char* name, 
lucene::store::IndexInput*& ret,
                                        CLuceneError& error, int32_t 
bufferSize) {
-    CND_PRECONDITION(directory[0] != 0, "directory is not open");
+    if (config::inverted_index_ram_dir_enable && dirType == 
DirType::WRITE_SEPARATED) {
+        std::lock_guard<std::mutex> wlock(_this_lock);
+        auto* file = filesMap->get((char *) name);
+        if (file == NULL) {
+            error.set(CL_ERR_IO, "[RAMDirectory::open] The requested file does 
not exist.");
+            return false;

Review Comment:
   warning: redundant boolean literal in conditional return statement 
[readability-simplify-boolean-expr]
   
   be/src/olap/rowset/segment_v2/inverted_index_compound_directory.cpp:751:
   ```diff
   -         if (file == NULL) {
   -             error.set(CL_ERR_IO, "[RAMDirectory::open] The requested file 
does not exist.");
   -             return false;
   -         }
   -         ret = _CLNEW lucene::store::RAMInputStream(file);
   -         return true;
   +         return static_cast<bool>(file != NULL);
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.cpp:
##########
@@ -516,13 +517,18 @@ int64_t DorisCompoundDirectory::FSIndexOutput::length() 
const {
 DorisCompoundDirectory::DorisCompoundDirectory() {
     filemode = 0644;
     this->lockFactory = nullptr;
+    if (config::inverted_index_ram_dir_enable && dirType == 
DirType::WRITE_SEPARATED) {
+        filesMap = _CLNEW FileMap(true, true);
+        this->sizeInBytes = 0;
+    }
 }
 
-void DorisCompoundDirectory::init(const io::FileSystemSPtr& _fs, const char* 
_path,
+void DorisCompoundDirectory::init(const io::FileSystemSPtr& _fs, const char* 
_path, DirType dir_type,

Review Comment:
   warning: method 'init' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static void DorisCompoundDirectory::init(const io::FileSystemSPtr& _fs, 
const char* _path, DirType dir_type,
   ```
   



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