kou commented on a change in pull request #11296:
URL: https://github.com/apache/arrow/pull/11296#discussion_r720649820



##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -1084,34 +1084,38 @@ struct MatchLike {
 
     Status status;
     std::string pattern;
-    if (!original_options.ignore_case &&
-        re2::RE2::FullMatch(original_options.pattern, 
kLikePatternIsSubstringMatch,
-                            &pattern)) {
-      MatchSubstringOptions converted_options{pattern, 
original_options.ignore_case};
-      MatchSubstringState converted_state(converted_options);
-      ctx->SetState(&converted_state);
-      status = MatchSubstring<StringType, PlainSubstringMatcher>::Exec(ctx, 
batch, out);
-    } else if (!original_options.ignore_case &&
-               re2::RE2::FullMatch(original_options.pattern, 
kLikePatternIsStartsWith,
-                                   &pattern)) {
-      MatchSubstringOptions converted_options{pattern, 
original_options.ignore_case};
-      MatchSubstringState converted_state(converted_options);
-      ctx->SetState(&converted_state);
-      status = MatchSubstring<StringType, PlainStartsWithMatcher>::Exec(ctx, 
batch, out);
-    } else if (!original_options.ignore_case &&
-               re2::RE2::FullMatch(original_options.pattern, 
kLikePatternIsEndsWith,
-                                   &pattern)) {
-      MatchSubstringOptions converted_options{pattern, 
original_options.ignore_case};
-      MatchSubstringState converted_state(converted_options);
-      ctx->SetState(&converted_state);
-      status = MatchSubstring<StringType, PlainEndsWithMatcher>::Exec(ctx, 
batch, out);
-    } else {
+    bool matched = false;
+    if (!original_options.ignore_case) {
+      if ((matched = re2::RE2::FullMatch(original_options.pattern,
+                                         kLikePatternIsSubstringMatch, 
&pattern))) {
+        MatchSubstringOptions converted_options{pattern, 
original_options.ignore_case};
+        MatchSubstringState converted_state(converted_options);
+        ctx->SetState(&converted_state);
+        status = MatchSubstring<StringType, PlainSubstringMatcher>::Exec(ctx, 
batch, out);
+      } else if ((matched = re2::RE2::FullMatch(original_options.pattern,
+                                                kLikePatternIsStartsWith, 
&pattern))) {
+        MatchSubstringOptions converted_options{pattern, 
original_options.ignore_case};
+        MatchSubstringState converted_state(converted_options);
+        ctx->SetState(&converted_state);
+        status =
+            MatchSubstring<StringType, PlainStartsWithMatcher>::Exec(ctx, 
batch, out);
+      } else if ((matched = re2::RE2::FullMatch(original_options.pattern,
+                                                kLikePatternIsEndsWith, 
&pattern))) {
+        MatchSubstringOptions converted_options{pattern, 
original_options.ignore_case};
+        MatchSubstringState converted_state(converted_options);
+        ctx->SetState(&converted_state);
+        status = MatchSubstring<StringType, PlainEndsWithMatcher>::Exec(ctx, 
batch, out);
+      }
+    }
+#ifdef ARROW_WITH_RE2

Review comment:
       It seems that here is already in `ARROW_WITH_RE2`: 
https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/scalar_string.cc#L1013-L1129




-- 
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]


Reply via email to