-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: regex query can't handle text with newline #32569
Conversation
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #32569 +/- ##
==========================================
- Coverage 81.83% 81.75% -0.08%
==========================================
Files 999 991 -8
Lines 124070 124622 +552
==========================================
+ Hits 101529 101890 +361
- Misses 18666 18850 +184
- Partials 3875 3882 +7
|
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
} | ||
|
||
std::string | ||
quote_meta(const std::string& s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always allocate new memory many times, do a precheck like go implementation should be better?
https://cs.opensource.google/go/go/+/refs/tags/go1.22.2:src/regexp/regexp.go;l=726
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link the reference code in comment?
} else { | ||
if (c == '\\') { | ||
escapeMode = true; | ||
escape_mode = true; | ||
} else if (c == src) { | ||
result += replacement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much string concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should replace %
but not \\%
with [\\s\\S]*
?
\\%
should be %
.
But current implementation did't do this at my view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much string concatenation.
use std::stringstream ?
use boost::regrex as @alexanderguzhva suggested |
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
is_special(char c); | ||
|
||
std::string | ||
quote_meta(const std::string& s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant code
}; | ||
|
||
template <> | ||
inline bool | ||
RegexMatcher::operator()(const std::string& operand) { | ||
return std::regex_match(operand, r_); | ||
return boost::regex_match(operand, r_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment boost corner case?
. don't match \n.
but .* match \n.
const std::string& replacement) { | ||
std::string result; | ||
translate_pattern_match_to_regex(const std::string& pattern) { | ||
std::string r; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use string builder to decrease memory allocation
@longjiquan E2e jenkins job failed, comment |
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
fixed, cc @chyezh |
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
\lgtm |
@longjiquan E2e jenkins job failed, comment |
/run-cpu-e2e |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: czs007, longjiquan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
issue: #32482