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


##########
be/src/olap/tablet_schema.cpp:
##########
@@ -1362,49 +1343,27 @@ void TabletSchema::update_tablet_columns(const 
TabletSchema& tablet_schema,
     }
 }
 
-bool TabletSchema::has_inverted_index(const TabletColumn& col) const {
-    // TODO use more efficient impl
-    int32_t col_unique_id = col.is_extracted_column() ? col.parent_unique_id() 
: col.unique_id();
-    const std::string& suffix_path =
-            col.has_path_info() ? 
escape_for_path_name(col.path_info_ptr()->get_path()) : "";
-    for (size_t i = 0; i < _indexes.size(); i++) {
-        if (_indexes[i].index_type() == IndexType::INVERTED) {
-            for (int32_t id : _indexes[i].col_unique_ids()) {
-                if (id == col_unique_id && _indexes[i].get_index_suffix() == 
suffix_path) {
-                    return true;
-                }
-            }
-        }
-    }
-
-    return false;
-}
-
-bool TabletSchema::has_inverted_index_with_index_id(int64_t index_id,
-                                                    const std::string& 
suffix_name) const {
+bool TabletSchema::has_inverted_index(int64_t index_id) const {
     for (size_t i = 0; i < _indexes.size(); i++) {
-        if (_indexes[i].index_type() == IndexType::INVERTED &&
-            _indexes[i].get_index_suffix() == suffix_name && 
_indexes[i].index_id() == index_id) {
+        if (_indexes[i].index_type() == IndexType::INVERTED && index_id == 
_indexes[i].index_id()) {
             return true;
         }
     }
     return false;
 }
 
-const TabletIndex* TabletSchema::get_inverted_index_with_index_id(
-        int64_t index_id, const std::string& suffix_name) const {
-    for (size_t i = 0; i < _indexes.size(); i++) {
-        if (_indexes[i].index_type() == IndexType::INVERTED &&
-            _indexes[i].get_index_suffix() == suffix_name && 
_indexes[i].index_id() == index_id) {
-            return &(_indexes[i]);
-        }
+bool TabletSchema::has_inverted_index(const TabletColumn& col) const {
+    int32_t col_unique_id = col.is_extracted_column() ? col.parent_unique_id() 
: col.unique_id();
+    const std::string& suffix_path =
+            col.has_path_info() ? 
escape_for_path_name(col.path_info_ptr()->get_path()) : "";
+    if (inverted_index(col_unique_id, suffix_path)) {
+        return true;

Review Comment:
   warning: redundant boolean literal in conditional return statement 
[readability-simplify-boolean-expr]
   
   be/src/olap/tablet_schema.cpp:1358:
   ```diff
   -     if (inverted_index(col_unique_id, suffix_path)) {
   -         return true;
   -     }
   -     return false;
   +     return static_cast<bool>(inverted_index(col_unique_id, suffix_path));
   ```
   



##########
be/test/olap/rowset/segment_v2/inverted_index/inverted_index_desc_test.cpp:
##########
@@ -0,0 +1,32 @@
+// 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 "olap/rowset/segment_v2/inverted_index_desc.h"
+
+#include <gtest/gtest.h>

Review Comment:
   warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gtest/gtest.h>
            ^
   ```
   



##########
be/src/olap/rowset/segment_v2/inverted_index_desc.cpp:
##########
@@ -19,6 +19,7 @@
 
 #include <fmt/format.h>

Review Comment:
   warning: 'fmt/format.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <fmt/format.h>
            ^
   ```
   



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