Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](inverted index) Fix match_regexp to correctly handle empty string patterns #39503

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions be/src/vec/functions/match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should consider other query

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
-- !sql --
1000

-- !sql --
1000

-- !sql --
54

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
-- !sql --
0

-- !sql --
1000

Original file line number Diff line number Diff line change
Expand Up @@ -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\$'; """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}

Expand Down
Loading