Xianqing He has uploaded this change for review. ( 
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)
---
M be/src/exprs/like-predicate-test.cc
M be/src/exprs/like-predicate.cc
2 files changed, 57 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/14/25114/1
--
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: newchange
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 1
Gerrit-Owner: Xianqing He <[email protected]>

Reply via email to