Skip to content

Commit

Permalink
[fix](inverted index) Fix incorrect usage of regexp compile_err (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzxl1993 authored Nov 8, 2024
1 parent 643ac39 commit 35071eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions be/src/vec/functions/match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
}

0 comments on commit 35071eb

Please sign in to comment.