Zoltán Borók-Nagy created IMPALA-15641:
------------------------------------------
Summary: LIKE fast paths ignore backslash escapes
Key: IMPALA-15641
URL: https://issues.apache.org/jira/browse/IMPALA-15641
Project: IMPALA
Issue Type: Bug
Components: Backend
Reporter: Zoltán Borók-Nagy
{{LikePredicate::OptimizeConstantPatternMatch()}} matches constant patterns and
simple prefix, suffix and substring patterns verbatim, but the regex path
treats a backslash as an escape character. So a backslash in a pattern means
something different depending on the shape of the pattern. IMPALA-10849 and
IMPALA-14731 fixed this for patterns that end with an escaped %, but not e.g.
for an escaped % before the trailing %:
{code:sql}
select 'abc%x' like 'abc\\%%'; -- false, expected true
select concat('abc', chr(92), 'x') like 'abc\\%%'; -- true, expected false
select 'abc%x' like 'abc\\%_%'; -- true (regex path)
select concat('C:', chr(92), 'dir') like 'C:\\dir%'; -- true (verbatim)
select concat('C:', chr(92), 'dirx') like 'C:\\dir%_'; -- false (regex path)
{code}
Fixing this changes how existing queries behave, e.g. the prefix pattern in the
4th query would no longer match. Iceberg LIKE push down has to change at the
same time, because it follows the backend's behavior (see IMPALA-15634).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)