Zoltan Borok-Nagy has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/25198


Change subject: IMPALA-15641: Interpret escapes in the fast paths of LIKE
......................................................................

IMPALA-15641: Interpret escapes in the fast paths of LIKE

LikePredicate::OptimizeConstantPatternMatch() matched constant patterns
and simple prefix, suffix and substring patterns verbatim, while the
regex path, which is also used for patterns that are not constant,
treats a backslash as an escape for any character and ignores a
trailing backslash. So the result depended on the shape of the
pattern, e.g. 'abc%x' LIKE 'abc\%%' was false, but
'abc%x' LIKE 'abc\%_%' was true. IMPALA-10849 and IMPALA-14731 fixed
this only for patterns that end with an escaped '%'.

The fast paths are now chosen and their search strings computed after
interpreting the escapes the same way as the regex path does, so they
are only an optimization. This changes the result of constant patterns
with a backslash before an ordinary character that took a fast path,
e.g. s LIKE 'C:\\dir%' (the pattern C:\dir%) now matches values that
start with 'C:dir', like the same non-constant pattern did, instead of
'C:\dir'. A literal backslash needs two backslashes in the pattern.
This differs from Hive, where a backslash only escapes '%' and '_'.

Iceberg LIKE push down follows the backend, so IcebergPredicateConverter
now also unescapes any character, and drops a trailing backslash.

Testing:
 - Added expr tests for escapes in fast path patterns, and updated the
   test of the chosen fast paths.
 - Added FE and EE tests for LIKE push down with escapes.

Change-Id: Ia8b6872a6a200bfadb36d3ee83869bde76b8f3a5
Assisted-by: Claude Opus 5.5 (Claude Code)
---
M be/src/exprs/expr-test.cc
M be/src/exprs/like-predicate-test.cc
M be/src/exprs/like-predicate.cc
M fe/src/main/java/org/apache/impala/common/IcebergPredicateConverter.java
M fe/src/test/java/org/apache/impala/common/IcebergPredicateConverterTest.java
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-like-pushdown.test
6 files changed, 189 insertions(+), 89 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/98/25198/1
--
To view, visit http://gerrit.cloudera.org:8080/25198
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8b6872a6a200bfadb36d3ee83869bde76b8f3a5
Gerrit-Change-Number: 25198
Gerrit-PatchSet: 1
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>

Reply via email to