mirror of
https://github.com/apache/impala.git
synced 2026-02-01 03:00:22 -05:00
A like predicate is generally evaluated by converting it into a regex that is evaluated at execution time. If the predicate of a like clause is a constant (which is the common case when you say "row like 'start%'") then there are optimizations where some cases that are simpler then a regex are spotted, and a simple function than a regex evaluator is used. One example is that a predicate such as ‘start%’ is evaluated by looking for strings that begin with "start". Amusingly the code that spots the potential optimizations uses regexes to look for patterns in the like predicate. The code that looks for the optimization where a simple prefix can be searched for does not deal with the case where the '%' wildcard at the end of the predicate is escaped. To fix this we add a test that deals with the case where the predicate ends in an escaped '%'. There are some other problems with escaped wildcards discussed in IMPALA-2422. This change does not fix these problems, which are hard. New tests for escaped wildcards are added to exprs.test - note that these tests cannot be part of the LikeTbl tests as the like predicate optimizations are only applied when the like predicate is a string literal. Exhaustive tests ran clean. Change-Id: I30356c19f4f169d99f7cc6268937653af6b41b70 Reviewed-on: http://gerrit.cloudera.org:8080/17798 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
78 KiB
78 KiB