Copilot commented on code in PR #51844:
URL: https://github.com/apache/doris/pull/51844#discussion_r2153532076


##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -502,27 +501,28 @@ Status StringTypeInvertedIndexReader::query(const 
io::IOContext* io_ctx,
                 return Status::Error<ErrorCode::INVERTED_INDEX_NOT_SUPPORTED>(
                         "invalid query type when query untokenized inverted 
index");
             }
-        } catch (const CLuceneError& e) {
-            if (is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
-                return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
-                        "range query term exceeds limits, try to downgrade 
from inverted index, "
-                        "column "
-                        "name:{}, search_str:{}",
-                        column_name, search_str);
-            } else {
-                return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                        "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
-                        e.what(), column_name, search_str);
-            }
         }
-
         // add to cache
         result->runOptimize();
         cache->insert(cache_key, result, &cache_handler);
 
         bit_map = result;
+        return Status::OK();
+    } catch (const CLuceneError& e) {
+        if (is_range_query(query_type) && e.number() == CL_ERR_TooManyClauses) 
{
+            return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
+                    "range query term exceeds limits, try to downgrade from 
inverted index, "
+                    "column "
+                    "name:{}, search_str:{}",
+                    column_name, search_str);
+        } else {
+            LOG(ERROR) << "CLuceneError occured, error msg: " << e.what()
+                       << ", column name: " << column_name << ", search_str: " 
<< search_str;
+            return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
+                    "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",

Review Comment:
   Typo in the log message: 'occured' should be spelled 'occurred'.
   ```suggestion
               LOG(ERROR) << "CLuceneError occurred, error msg: " << e.what()
                          << ", column name: " << column_name << ", search_str: 
" << search_str;
               return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
                       "CLuceneError occurred, error msg: {}, column name: {}, 
search_str: {}",
   ```



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -502,27 +501,28 @@ Status StringTypeInvertedIndexReader::query(const 
io::IOContext* io_ctx,
                 return Status::Error<ErrorCode::INVERTED_INDEX_NOT_SUPPORTED>(
                         "invalid query type when query untokenized inverted 
index");
             }
-        } catch (const CLuceneError& e) {
-            if (is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
-                return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
-                        "range query term exceeds limits, try to downgrade 
from inverted index, "
-                        "column "
-                        "name:{}, search_str:{}",
-                        column_name, search_str);
-            } else {
-                return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                        "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
-                        e.what(), column_name, search_str);
-            }
         }
-
         // add to cache
         result->runOptimize();
         cache->insert(cache_key, result, &cache_handler);
 
         bit_map = result;
+        return Status::OK();
+    } catch (const CLuceneError& e) {

Review Comment:
   [nitpick] Consider adding a catch-all handler (e.g., `catch(const 
std::exception& e)`) after this block to prevent any other unexpected 
exceptions from crashing the process.



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -502,27 +501,28 @@ Status StringTypeInvertedIndexReader::query(const 
io::IOContext* io_ctx,
                 return Status::Error<ErrorCode::INVERTED_INDEX_NOT_SUPPORTED>(
                         "invalid query type when query untokenized inverted 
index");
             }
-        } catch (const CLuceneError& e) {
-            if (is_range_query(query_type) && e.number() == 
CL_ERR_TooManyClauses) {
-                return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
-                        "range query term exceeds limits, try to downgrade 
from inverted index, "
-                        "column "
-                        "name:{}, search_str:{}",
-                        column_name, search_str);
-            } else {
-                return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                        "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",
-                        e.what(), column_name, search_str);
-            }
         }
-
         // add to cache
         result->runOptimize();
         cache->insert(cache_key, result, &cache_handler);
 
         bit_map = result;
+        return Status::OK();
+    } catch (const CLuceneError& e) {
+        if (is_range_query(query_type) && e.number() == CL_ERR_TooManyClauses) 
{
+            return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
+                    "range query term exceeds limits, try to downgrade from 
inverted index, "
+                    "column "
+                    "name:{}, search_str:{}",
+                    column_name, search_str);
+        } else {
+            LOG(ERROR) << "CLuceneError occured, error msg: " << e.what()
+                       << ", column name: " << column_name << ", search_str: " 
<< search_str;
+            return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
+                    "CLuceneError occured, error msg: {}, column name: {}, 
search_str: {}",

Review Comment:
   Typo in the error message: 'occured' should be spelled 'occurred'.
   ```suggestion
               LOG(ERROR) << "CLuceneError occurred, error msg: " << e.what()
                          << ", column name: " << column_name << ", search_str: 
" << search_str;
               return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
                       "CLuceneError occurred, error msg: {}, column name: {}, 
search_str: {}",
   ```



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