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 c8a0d3e03cc [fix](invert index) fix error handling for match_regexp resulting in an empty match. (#29233) c8a0d3e03cc is described below commit c8a0d3e03ccd13af5f18fa2af1a2fb41ecae2790 Author: zzzxl <33418555+zzzxl1...@users.noreply.github.com> AuthorDate: Thu Dec 28 19:58:41 2023 +0800 [fix](invert index) fix error handling for match_regexp resulting in an empty match. (#29233) --- .../rowset/segment_v2/inverted_index/query/regexp_query.cpp | 10 ++++++++-- .../data/inverted_index_p0/test_index_match_regexp.out | 3 +++ .../suites/inverted_index_p0/test_index_match_regexp.groovy | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/be/src/olap/rowset/segment_v2/inverted_index/query/regexp_query.cpp b/be/src/olap/rowset/segment_v2/inverted_index/query/regexp_query.cpp index 83c5401bac0..ee959e1da73 100644 --- a/be/src/olap/rowset/segment_v2/inverted_index/query/regexp_query.cpp +++ b/be/src/olap/rowset/segment_v2/inverted_index/query/regexp_query.cpp @@ -70,10 +70,12 @@ void RegexpQuery::add(const std::wstring& field_name, const std::string& pattern } if (is_match) { - terms.emplace_back(std::move(input)); - if (++count >= _max_expansions) { + if (_max_expansions > 0 && count >= _max_expansions) { break; } + + terms.emplace_back(std::move(input)); + count++; } _CLDECDELETE(term); @@ -88,6 +90,10 @@ void RegexpQuery::add(const std::wstring& field_name, const std::string& pattern hs_free_database(database); }) + if (terms.empty()) { + return; + } + query.add(field_name, terms); } 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 eab27de65ee..f9a9caf6d74 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 @@ -14,3 +14,6 @@ -- !sql -- 38 +-- !sql -- +0 + 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 7567102d596..3458f086740 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 @@ -85,6 +85,8 @@ suite("test_index_match_regexp", "p0"){ qt_sql """ select count() from test_index_match_regexp where request match_regexp 's\$'; """ qt_sql """ select count() from test_index_match_regexp where request match_regexp 'er\$'; """ qt_sql """ select count() from test_index_match_regexp where request match_regexp '.*tickets.*'; """ + qt_sql """ select count() from test_index_match_regexp where request match_regexp 'nonexistence'; """ + } finally { //try_sql("DROP TABLE IF EXISTS ${testTable}") } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org