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 (#2).
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 '_'.
A trailing backslash that doesn't escape anything is now a literal
backslash in all paths, like in Hive and MySQL. Before, the fast paths
matched it verbatim, but the regex path ignored it, e.g.
s LIKE 'a%\\' (the pattern a%\) matched every value starting with 'a'.
Iceberg LIKE push down follows the backend, so IcebergPredicateConverter
now also unescapes any character.
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, 208 insertions(+), 88 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/98/25198/2
--
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: 2
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]>