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

jianliangqi 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 43f00507d29 [fix](inverted index) Fix match_regexp to correctly handle 
empty string patterns (#39503)
43f00507d29 is described below

commit 43f00507d29233b00c9654bbdd3dc52916b830f6
Author: zzzxl <[email protected]>
AuthorDate: Thu Aug 22 15:42:10 2024 +0800

    [fix](inverted index) Fix match_regexp to correctly handle empty string 
patterns (#39503)
    
    1. Handle empty strings consistently for match_phrase with and without an 
index.
---
 be/src/vec/functions/match.cpp                                   | 9 ---------
 .../data/inverted_index_p0/test_index_match_regexp.out           | 3 +++
 regression-test/data/inverted_index_p0/test_no_index_match.out   | 3 +++
 .../suites/inverted_index_p0/test_index_match_regexp.groovy      | 1 +
 .../suites/inverted_index_p0/test_no_index_match.groovy          | 2 ++
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/be/src/vec/functions/match.cpp b/be/src/vec/functions/match.cpp
index e21e467d096..a506dfac325 100644
--- a/be/src/vec/functions/match.cpp
+++ b/be/src/vec/functions/match.cpp
@@ -406,15 +406,6 @@ Status FunctionMatchRegexp::execute_match(FunctionContext* 
context, const std::s
     VLOG_DEBUG << "begin to run FunctionMatchRegexp::execute_match, 
parser_type: "
                << 
inverted_index_parser_type_to_string(inverted_index_ctx->parser_type);
 
-    if (match_query_str.empty()) {
-        VLOG_DEBUG << fmt::format(
-                "token parser result is empty for query, "
-                "please check your query: '{}' and index parser: '{}'",
-                match_query_str,
-                
inverted_index_parser_type_to_string(inverted_index_ctx->parser_type));
-        return Status::OK();
-    }
-
     const std::string& pattern = match_query_str;
 
     hs_database_t* database = nullptr;
diff --git a/regression-test/data/inverted_index_p0/test_index_match_regexp.out 
b/regression-test/data/inverted_index_p0/test_index_match_regexp.out
index f9a9caf6d74..fb5d23ad266 100644
--- a/regression-test/data/inverted_index_p0/test_index_match_regexp.out
+++ b/regression-test/data/inverted_index_p0/test_index_match_regexp.out
@@ -2,6 +2,9 @@
 -- !sql --
 1000
 
+-- !sql --
+1000
+
 -- !sql --
 54
 
diff --git a/regression-test/data/inverted_index_p0/test_no_index_match.out 
b/regression-test/data/inverted_index_p0/test_no_index_match.out
index 932dd55fc5a..ea3bd71bcd6 100644
--- a/regression-test/data/inverted_index_p0/test_no_index_match.out
+++ b/regression-test/data/inverted_index_p0/test_no_index_match.out
@@ -20,3 +20,6 @@
 -- !sql --
 0
 
+-- !sql --
+1000
+
diff --git 
a/regression-test/suites/inverted_index_p0/test_index_match_regexp.groovy 
b/regression-test/suites/inverted_index_p0/test_index_match_regexp.groovy
index 3458f086740..31863432707 100644
--- a/regression-test/suites/inverted_index_p0/test_index_match_regexp.groovy
+++ b/regression-test/suites/inverted_index_p0/test_index_match_regexp.groovy
@@ -80,6 +80,7 @@ suite("test_index_match_regexp", "p0"){
 
         sql "sync"
 
+        qt_sql """ select count() from test_index_match_regexp where request 
match_regexp ''; """
         qt_sql """ select count() from test_index_match_regexp where request 
match_regexp '^h'; """
         qt_sql """ select count() from test_index_match_regexp where request 
match_regexp '^team'; """
         qt_sql """ select count() from test_index_match_regexp where request 
match_regexp 's\$'; """
diff --git 
a/regression-test/suites/inverted_index_p0/test_no_index_match.groovy 
b/regression-test/suites/inverted_index_p0/test_no_index_match.groovy
index 2df40235a3f..7947844565c 100644
--- a/regression-test/suites/inverted_index_p0/test_no_index_match.groovy
+++ b/regression-test/suites/inverted_index_p0/test_no_index_match.groovy
@@ -94,6 +94,8 @@ suite("test_no_index_match", "p0") {
 
           qt_sql """ select count() from ${testTable} where (request 
match_phrase '欧冶工业品');  """
           qt_sql """ select count() from ${testTable} where (request 
match_phrase_prefix '欧冶工业品');  """
+
+          qt_sql """ select count() from ${testTable} where (request 
match_regexp '');  """
       } finally {
       }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to