Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/23932 )
Change subject: IMPALA-12374: Optimize trailing/leading % in LIKE ...................................................................... Patch Set 9: (2 comments) http://gerrit.cloudera.org:8080/#/c/23932/9/be/src/exprs/like-predicate.cc File be/src/exprs/like-predicate.cc: http://gerrit.cloudera.org:8080/#/c/23932/9/be/src/exprs/like-predicate.cc@70 PS9, Line 70: if (context->IsArgConstant(1)) { We have existing tests for the correctness of LIKE. If we restructured this a bit, we could have tests for this logic deciding optimizations for LIKE. Basically, if we create a separate function that takes in a pattern and decides the right way to implement it like the logic below, then we can test that function directly. It can tell that our new optimizations are being applied to specific like strings. http://gerrit.cloudera.org:8080/#/c/23932/9/be/src/exprs/like-predicate.cc@109 PS9, Line 109: if (case_sensitive && : RE2::FullMatch(pattern_str, leading_trailing_re, &trimmed_pattern) && : !RE2::FullMatch(pattern_str, ends_with_escaped_wildcard)) { : // e.g. '%a%b%' : re_pattern_val = StringVal(trimmed_pattern.c_str()); : re_full_match = false; : } else if(case_sensitive && : RE2::FullMatch(pattern_str, leading_re, &trimmed_pattern)) { : // e.g. '%a%b' : re_pattern_val = StringVal(trimmed_pattern.c_str()); : re_full_match = false; : re_anchor_end = true; : } else if(case_sensitive && : RE2::FullMatch(pattern_str, trailing_re, &trimmed_pattern) && : !RE2::FullMatch(pattern_str, ends_with_escaped_wildcard)) { : // e.g. ''a%b%' : re_pattern_val = StringVal(trimmed_pattern.c_str()); : re_full_match = false; : re_anchor_start = true; : } Can we add some test cases in expr-test.cc's LikePredicate() to cover some of these optimized cases? I don't see cases like 'a%b%' or '%a%b' or '%a%b%' there. -- To view, visit http://gerrit.cloudera.org:8080/23932 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I37b472e056f791035d25633f17ad8a6e841cdd18 Gerrit-Change-Number: 23932 Gerrit-PatchSet: 9 Gerrit-Owner: Balazs Hevele <[email protected]> Gerrit-Reviewer: Balazs Hevele <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Joe McDonnell <[email protected]> Gerrit-Comment-Date: Wed, 11 Feb 2026 22:28:10 +0000 Gerrit-HasComments: Yes
