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


##########
be/src/olap/rowset/segment_v2/segment.cpp:
##########
@@ -617,7 +633,12 @@
                                             
std::unique_ptr<InvertedIndexIterator>* iter) {
     ColumnReader* reader = _get_column_reader(tablet_column);
     if (reader != nullptr && index_meta) {
-        RETURN_IF_ERROR(reader->new_inverted_index_iterator(index_meta, 
read_options, iter));
+        if (_inverted_index_file_reader == nullptr) {
+            RETURN_IF_ERROR(
+                    _inverted_index_file_reader_open.call([&] { return 
_open_inverted_index(); }));
+        }
+        
RETURN_IF_ERROR(reader->new_inverted_index_iterator(_inverted_index_file_reader,
 index_meta,
+                                                            read_options, 
iter));

Review Comment:
   warning: function 'lookup_row_key' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
   Status Segment::lookup_row_key(const Slice& key, bool with_seq_col, bool 
with_rowid,
                   ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/rowset/segment_v2/segment.cpp:640:** 85 lines including 
whitespace and comments (threshold 80)
   ```cpp
   Status Segment::lookup_row_key(const Slice& key, bool with_seq_col, bool 
with_rowid,
                   ^
   ```
   
   </details>
   



##########
be/src/olap/rowset/segment_v2/segment.cpp:
##########
@@ -115,6 +116,21 @@ Status Segment::_open() {
     return Status::OK();
 }
 
+Status Segment::_open_inverted_index() {
+    _inverted_index_file_reader = std::make_shared<InvertedIndexFileReader>(
+            _file_reader->fs(), _file_reader->path().parent_path(),
+            _file_reader->path().filename().native(),
+            _tablet_schema->get_inverted_index_storage_format());
+    bool open_idx_file_cache = true;
+    auto st = 
_inverted_index_file_reader->init(config::inverted_index_read_buffer_size,
+                                                open_idx_file_cache);
+    if (st.is<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>()) {
+        LOG(INFO) << st;
+        return Status::OK();
+    }
+    return st;
+}
+

Review Comment:
   warning: function 'new_iterator' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
   Status Segment::new_iterator(SchemaSPtr schema, const StorageReadOptions& 
read_options,
                   ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/rowset/segment_v2/segment.cpp:132:** 88 lines including 
whitespace and comments (threshold 80)
   ```cpp
   Status Segment::new_iterator(SchemaSPtr schema, const StorageReadOptions& 
read_options,
                   ^
   ```
   
   </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