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

[Refactor] Chop too large hyperscan regex pattern when logging it on an error (backport #52467) #52526

Merged
merged 1 commit into from
Nov 1, 2024
Merged
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
4 changes: 3 additions & 1 deletion be/src/exprs/like_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ bool LikePredicate::hs_compile_and_alloc_scratch(const std::string& pattern, Lik
if (hs_compile(pattern.c_str(), HS_FLAG_ALLOWEMPTY | HS_FLAG_DOTALL | HS_FLAG_UTF8 | HS_FLAG_SINGLEMATCH,
HS_MODE_BLOCK, nullptr, &state->database, &state->compile_err) != HS_SUCCESS) {
std::stringstream error;
error << "Invalid hyperscan expression: " << std::string(slice.data, slice.size) << ": "
auto chopped_size = std::min<size_t>(slice.size, 64);
auto ellipsis = (chopped_size < slice.size) ? "..." : "";
error << "Invalid hyperscan expression: " << std::string(slice.data, chopped_size) << ellipsis << ": "
<< state->compile_err->message << PROMPT_INFO;
LOG(WARNING) << error.str().c_str();
hs_free_compile_error(state->compile_err);
Expand Down
Loading