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 6a7f02cbd85 [fix](inverted index) Fix incorrect usage of regexp 
compile_err (#41944)
6a7f02cbd85 is described below

commit 6a7f02cbd8579052af51122a4dc0873ea71326af
Author: zzzxl <33418555+zzzxl1...@users.noreply.github.com>
AuthorDate: Thu Oct 17 20:40:12 2024 +0800

    [fix](inverted index) Fix incorrect usage of regexp compile_err (#41944)
---
 be/src/vec/functions/match.cpp                                     | 7 ++++---
 .../suites/inverted_index_p0/test_no_index_match.groovy            | 7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/functions/match.cpp b/be/src/vec/functions/match.cpp
index bbdabe3c506..5b74c3b9c18 100644
--- a/be/src/vec/functions/match.cpp
+++ b/be/src/vec/functions/match.cpp
@@ -457,10 +457,11 @@ Status 
FunctionMatchRegexp::execute_match(FunctionContext* context, const std::s
 
     if (hs_compile(pattern.data(), HS_FLAG_DOTALL | HS_FLAG_ALLOWEMPTY | 
HS_FLAG_UTF8,
                    HS_MODE_BLOCK, nullptr, &database, &compile_err) != 
HS_SUCCESS) {
-        LOG(ERROR) << "hyperscan compilation failed: " << compile_err->message;
+        std::string err_message = "hyperscan compilation failed: ";
+        err_message.append(compile_err->message);
+        LOG(ERROR) << err_message;
         hs_free_compile_error(compile_err);
-        return Status::Error<ErrorCode::INVERTED_INDEX_INVALID_PARAMETERS>(
-                std::string("hyperscan compilation failed:") + 
compile_err->message);
+        return 
Status::Error<ErrorCode::INVERTED_INDEX_INVALID_PARAMETERS>(err_message);
     }
 
     if (hs_alloc_scratch(database, &scratch) != HS_SUCCESS) {
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 7cace77da7e..dafdb645531 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
@@ -113,6 +113,13 @@ suite("test_no_index_match", "p0") {
         log.info(e.getMessage());
         assertTrue(e.getMessage().contains("match_phrase_prefix not support 
execute_match"))
       }
+
+      try {
+          sql """ select count() from ${testTable} where (request match_regexp 
'?');  """
+      } catch (Exception e) {
+        log.info(e.getMessage());
+        assertTrue(e.getMessage().contains("hyperscan compilation failed: 
Invalid repeat at index 0."))
+      }
     } finally {
     }
 }
\ No newline at end of file


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

Reply via email to