xiaokang commented on code in PR #16994:
URL: https://github.com/apache/doris/pull/16994#discussion_r1113138741


##########
be/src/olap/column_predicate.h:
##########
@@ -110,6 +110,10 @@ struct PredicateTypeTraits {
         return (type == PredicateType::IN_LIST || type == 
PredicateType::NOT_IN_LIST);
     }
 
+    static constexpr bool is_eqaul_and_list(PredicateType type) {

Review Comment:
   typo: equal



##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -550,21 +550,35 @@ bool 
SegmentIterator::_check_apply_by_bitmap_index(ColumnPredicate* pred) {
     return true;
 }
 
-bool SegmentIterator::_check_apply_by_inverted_index(ColumnPredicate* pred) {
+bool SegmentIterator::_check_apply_by_inverted_index(ColumnPredicate* pred, 
bool pred_in_compound) {
     int32_t unique_id = _schema.unique_id(pred->column_id());
-    bool handle_by_fulltext = _is_handle_predicate_by_fulltext(unique_id);
-
     if (_inverted_index_iterators.count(unique_id) < 1 ||
-        _inverted_index_iterators[unique_id] == nullptr ||
-        (pred->type() != PredicateType::MATCH && handle_by_fulltext) ||
-        pred->type() == PredicateType::IS_NULL || pred->type() == 
PredicateType::IS_NOT_NULL ||
-        pred->type() == PredicateType::BF) {
-        // 1. this column without inverted index
-        // 2. equal or range qeury for fulltext index
-        // 3. is_null or is_not_null predicate
-        // 4. bloom filter predicate
+        _inverted_index_iterators[unique_id] == nullptr) {
+        //this column without inverted index
+        return false;
+    }
+
+    if (_inverted_index_not_support_pred_type(pred->type())) {
         return false;
     }
+
+    if ((pred->type() == PredicateType::IN_LIST || pred->type() == 
PredicateType::NOT_IN_LIST) &&
+        pred->predicate_params()->marked_by_runtime_filter) {
+        // in_list or not_in_list predicate produced by runtime filter
+        return false;
+    }
+
+    bool handle_by_fulltext = _column_has_fulltext_index(unique_id);
+    if (handle_by_fulltext) {
+        // when predicate in compound condition which except leafNode of 
andNode,
+        // only can apply match query for fulltext index,
+        // when predicate is leafNode of andNode,
+        // can apply 'match qeury' and 'equal query' and 'list query' for 
fulltext index.
+        return (pred_in_compound ? pred->type() == PredicateType::MATCH
+                                 : (pred->type() == PredicateType::MATCH ||
+                                    
PredicateTypeTraits::is_eqaul_and_list(pred->type())));
+    }

Review Comment:
   Is it right to return true if handle_by_fulltext == false ?



##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -679,30 +698,21 @@ bool 
SegmentIterator::_is_handle_predicate_by_fulltext(int32_t unique_id) {
 Status SegmentIterator::_apply_inverted_index_on_column_predicate(
         ColumnPredicate* pred, std::vector<ColumnPredicate*>& 
remaining_predicates,
         bool* continue_apply) {
-    int32_t unique_id = _schema.unique_id(pred->column_id());
-    bool handle_by_fulltext = _is_handle_predicate_by_fulltext(unique_id);
-
-    if (_inverted_index_iterators.count(unique_id) < 1 ||
-        _inverted_index_iterators[unique_id] == nullptr ||
-        (pred->type() != PredicateType::MATCH && handle_by_fulltext) ||
-        pred->type() == PredicateType::IS_NULL || pred->type() == 
PredicateType::IS_NOT_NULL ||
-        pred->type() == PredicateType::BF ||
-        ((pred->type() == PredicateType::IN_LIST || pred->type() == 
PredicateType::NOT_IN_LIST) &&
-         pred->predicate_params()->marked_by_runtime_filter)) {
-        // 1. this column no inverted index
-        // 2. equal or range for fulltext index
-        // 3. is_null or is_not_null predicate
-        // 4. bloom filter predicate
-        // 5. in_list or not_in_list predicate produced by runtime filter
+    if (!_check_apply_by_inverted_index(pred)) {
         remaining_predicates.emplace_back(pred);
     } else {
+        int32_t unique_id = _schema.unique_id(pred->column_id());
+        bool need_remaining_after_evaluate = 
_column_has_fulltext_index(unique_id) &&
+                                             
PredicateTypeTraits::is_eqaul_and_list(pred->type());
         roaring::Roaring bitmap = _row_bitmap;
         Status res =
                 pred->evaluate(_schema, _inverted_index_iterators[unique_id], 
num_rows(), &bitmap);
         if (!res.ok()) {
             if ((res.code() == ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND &&
                  pred->type() != PredicateType::MATCH) ||
-                res.code() == ErrorCode::INVERTED_INDEX_FILE_HIT_LIMIT) {
+                res.code() == ErrorCode::INVERTED_INDEX_FILE_HIT_LIMIT ||
+                (res.code() == ErrorCode::INVERTED_INDEX_NO_TERMS &&

Review Comment:
   add comment for NO_TERMS condition



##########
be/src/olap/column_predicate.h:
##########
@@ -110,6 +110,10 @@ struct PredicateTypeTraits {
         return (type == PredicateType::IN_LIST || type == 
PredicateType::NOT_IN_LIST);
     }
 
+    static constexpr bool is_eqaul_and_list(PredicateType type) {

Review Comment:
   is_equal_or_list



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