Impala Public Jenkins has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/25114 )
Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................
IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
IMPALA-12374 optimized constant LIKE/ILIKE patterns by trimming leading and
trailing % wildcards and using anchored partial regex matching. The
conversions to StringVal used the null-terminated StringVal(const char*)
constructor, whose length comes from strlen(). A constant pattern with an
embedded NUL byte was therefore silently truncated before
ConvertLikePattern() compiled the regex, producing wrong LIKE/ILIKE results.
Use the length-aware StringVal(uint8_t*, int) constructor for the raw and
trimmed pattern in OptimizeConstantPatternMatch() to preserve every byte.
Testing:
- Added regression tests in be/src/exprs/like-predicate-test.cc covering an
untrimmed pattern ("a%NULb") and a pattern trimmed on both sides
("%aNUL_%"), with matching and non-matching values, in case-sensitive and
case-insensitive modes. Verified they fail before the fix and pass after.
Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Assisted-by: DeepSeek V4.1 Flash (opencode)
Reviewed-on: http://gerrit.cloudera.org:8080/25114
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/exprs/like-predicate-test.cc
M be/src/exprs/like-predicate.cc
2 files changed, 57 insertions(+), 4 deletions(-)
Approvals:
Impala Public Jenkins: Looks good to me, approved; Verified
--
To view, visit http://gerrit.cloudera.org:8080/25114
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 3
Gerrit-Owner: Xianqing He <[email protected]>
Gerrit-Reviewer: Balazs Hevele <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>