Hello Arnab Karmakar, Balazs Hevele, Csaba Ringhofer, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
https://gerrit.cloudera.org/25198
to look at the new patch set (#4).
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 '%'.
Now all paths follow the same rule: a backslash escapes '%', '_' and
itself, and before any other character, or at the end of the pattern,
it is a literal backslash. This matches Hive, except that '\\' is two
backslashes in Hive. The fast paths are chosen and their search strings
computed after interpreting the escapes, so they are only an
optimization. Patterns that are not valid UTF-8 still take the regex
path, which rejects them.
Changed results, where '...' is any string and '?' is any character.
The patterns are after SQL string literal unescaping, e.g.
s LIKE 'C:\\dir%' is the pattern C:\dir%.
Pattern Path Before After
abc\%% fast abc\... abc%...
%\%% fast ...\... ...%...
a\\b% fast a\\b... a\b...
C:\dir_% regex C:dir?... C:\dir?...
a%\ regex a... a...\
Patterns that are not constant and ILIKE always took the regex path,
e.g. C:\dir% matched C:dir... for them.
IcebergPredicateConverter mirrored the verbatim fast paths when pushing
down LIKE to Iceberg (IMPALA-15634). Now it unescapes every pattern the
same way as the backend.
Testing:
- Added BE tests for the escapes, also checking that the fast paths
match the same values as the regex for non-constant patterns.
- Updated FE tests and added 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 be/src/exprs/like-predicate.h
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
7 files changed, 375 insertions(+), 211 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/98/25198/4
--
To view, visit https://gerrit.cloudera.org/25198
To unsubscribe, visit https://gerrit.cloudera.org/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia8b6872a6a200bfadb36d3ee83869bde76b8f3a5
Gerrit-Change-Number: 25198
Gerrit-PatchSet: 4
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Balazs Hevele <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>