You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2023/01/31 13:34:39 UTC

[doris] branch master updated: [fix](inverted index) fix some bug about fulltext match query with compound conditions (#16226)

This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 934f2de8da [fix](inverted index) fix some bug about fulltext match query with compound conditions (#16226)
934f2de8da is described below

commit 934f2de8da55b20843d76560347487e99d57f9fd
Author: YueW <45...@users.noreply.github.com>
AuthorDate: Tue Jan 31 21:34:30 2023 +0800

    [fix](inverted index) fix some bug about fulltext match query with compound conditions (#16226)
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 14 +++++++++++---
 be/src/vec/functions/function.h                    |  9 ++++++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 7d7f8be0a7..99721e292a 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -466,8 +466,12 @@ Status SegmentIterator::_execute_predicates_except_leafnode_of_andnode(vectorize
     } else if (_is_literal_node(node_type)) {
         auto v_literal_expr = dynamic_cast<doris::vectorized::VLiteral*>(expr);
         _column_predicate_info->query_value = v_literal_expr->value();
-    } else if (node_type == TExprNodeType::BINARY_PRED) {
-        _column_predicate_info->query_op = expr->fn().name.function_name;
+    } else if (node_type == TExprNodeType::BINARY_PRED || node_type == TExprNodeType::MATCH_PRED) {
+        if (node_type == TExprNodeType::MATCH_PRED) {
+            _column_predicate_info->query_op = "match";
+        } else {
+            _column_predicate_info->query_op = expr->fn().name.function_name;
+        }
         // get child condition result in compound condtions
         auto pred_result_sign = _gen_predicate_result_sign(_column_predicate_info.get());
         _column_predicate_info.reset(new ColumnPredicateInfo());
@@ -536,9 +540,13 @@ bool SegmentIterator::_check_apply_by_inverted_index(ColumnPredicate* pred) {
     int32_t unique_id = _schema.unique_id(pred->column_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::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
         return false;
     }
     return true;
diff --git a/be/src/vec/functions/function.h b/be/src/vec/functions/function.h
index 334497d0c7..dac7700fb6 100644
--- a/be/src/vec/functions/function.h
+++ b/be/src/vec/functions/function.h
@@ -532,7 +532,14 @@ public:
     bool can_fast_execute() const override {
         return function->get_name() == "eq" || function->get_name() == "ne" ||
                function->get_name() == "lt" || function->get_name() == "gt" ||
-               function->get_name() == "le" || function->get_name() == "ge";
+               function->get_name() == "le" || function->get_name() == "ge" ||
+               function->get_name() == "match_any" || function->get_name() == "match_all" ||
+               function->get_name() == "match_phrase" ||
+               function->get_name() == "match_element_eq" ||
+               function->get_name() == "match_element_lt" ||
+               function->get_name() == "match_element_gt" ||
+               function->get_name() == "match_element_le" ||
+               function->get_name() == "match_element_ge";
     }
 
     bool is_deterministic_in_scope_of_query() const override {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org