westonpace commented on code in PR #33806:
URL: https://github.com/apache/arrow/pull/33806#discussion_r1083298939
##########
cpp/src/arrow/compute/kernels/scalar_string_ascii.cc:
##########
@@ -1505,6 +1508,13 @@ struct MatchLike {
static const RE2 kLikePatternIsStartsWith(R"(([^%_]*[^\\%_])?%+)",
kRE2Options);
// A LIKE pattern matching this regex can be translated into a suffix
search.
static const RE2 kLikePatternIsEndsWith(R"(%+([^%_]*))", kRE2Options);
+ static bool global_checked = false;
Review Comment:
Given that these are constants it seems pretty unlikely that they would
fail. You could probably just DCHECK_OK or abort if they fail. That being
said, I agree this is probably a fine solution as well. You could also do
something like...
```
template <typename StringType>
struct LikePatterns {
RE2::Options kRE2Options = ...
RE2 kLikePatternIsSubstringMatch(...);
RE2 kLikePatternIsStartsWith(...);
RE2 kLikePatternIsEndsWith(...);
static Result<LikePatterns> Make() {
RETURN_NOT_OK(...)
}
};
template <typename StringType>
struct MatchLike {
static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult*
out) {
static const Result<LikePatterns> kLikePatterns = LikePatterns::Make();
RETURN_NOT_OK(kLikePatterns);
...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]