-
Notifications
You must be signed in to change notification settings - Fork 58
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
Implement REPLACE #1085
Implement REPLACE #1085
Conversation
…ly b.c. of the unique_ptr), but we will see.
struct RegexValueGetter { | ||
std::unique_ptr<re2::RE2> operator()(SingleExpressionResult auto&& input, | ||
const EvaluationContext* context) const | ||
requires requires { StringValueGetter{}(AD_FWD(input), context); } { |
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.
TODO Comment the regexValueGetter and maybe move it somewhere.
also TODO Can we implement the Ordinary
regex expression as an NARY-Operation
with specialized functions?
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1085 +/- ##
==========================================
+ Coverage 79.89% 80.22% +0.33%
==========================================
Files 277 279 +2
Lines 26426 26792 +366
Branches 3266 3301 +35
==========================================
+ Hits 21113 21495 +382
+ Misses 3961 3937 -24
- Partials 1352 1360 +8
☔ View full report in Codecov by Sentry. |
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.
So great to finally have this, minor changes left
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
The
REPLACE
function is now implemented. Note the following details:According to the standard,
REPLACE
takes an optional fourth argument for the flags. This is not yet supported. However, the flags can equivalently be prepended to the regular expression. For example, to get a case-insensitive regular expression, prepend(?i)
. The newRegexValueGetter
is not yet used inFILTER
clauses, where prefix regular expressions are treated specially for efficiency reasons.For constant values that are repeated multiple times (for each result row), the value is now evaluated only once and then repeated. In particular, in a
REPLACE
with a constant regular expression (the typical case), the regular expression is now compiled only once. This also avoids copying a constant string (for example, in a call toCONCAT
) many times.