This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit cc963b0f71235e5173b0b86022baea832662dcf4 Author: airborne12 <[email protected]> AuthorDate: Mon Jan 29 11:23:55 2024 +0800 [Refact](inverted index) use boost regex to resolve stack overflow issues (#30477) --- be/src/vec/functions/function_tokenize.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/be/src/vec/functions/function_tokenize.cpp b/be/src/vec/functions/function_tokenize.cpp index 42f27a116ed..2ecd164a598 100644 --- a/be/src/vec/functions/function_tokenize.cpp +++ b/be/src/vec/functions/function_tokenize.cpp @@ -20,7 +20,7 @@ #include <glog/logging.h> #include <algorithm> -#include <regex> +#include <boost/regex.hpp> #include <utility> #include "CLucene/StdHeader.h" @@ -36,16 +36,18 @@ namespace doris::vectorized { Status parse(const std::string& str, std::map<std::string, std::string>& result) { - std::regex pattern( + boost::regex pattern( R"delimiter((?:'([^']*)'|"([^"]*)"|([^,]*))\s*=\s*(?:'([^']*)'|"([^"]*)"|([^,]*)))delimiter"); - std::smatch matches; + boost::smatch matches; std::string::const_iterator searchStart(str.cbegin()); - while (std::regex_search(searchStart, str.cend(), matches, pattern)) { - std::string key = - matches[1].length() ? matches[1] : (matches[2].length() ? matches[2] : matches[3]); - std::string value = - matches[4].length() ? matches[4] : (matches[5].length() ? matches[5] : matches[6]); + while (boost::regex_search(searchStart, str.cend(), matches, pattern)) { + std::string key = matches[1].length() + ? matches[1].str() + : (matches[2].length() ? matches[2].str() : matches[3].str()); + std::string value = matches[4].length() + ? matches[4].str() + : (matches[5].length() ? matches[5].str() : matches[6].str()); result[key] = value; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
