You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Xianqing He (Code Review)" <ge...@cloudera.org> on 2026/10/13 11:08:17 UTC

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

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 <he...@126.com>

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25114 )

Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/24494/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
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: comment
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 1
Gerrit-Owner: Xianqing He <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 11:34:06 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Csaba Ringhofer (Code Review)" <ge...@cloudera.org>.
Csaba Ringhofer has posted comments on this change. ( http://gerrit.cloudera.org:8080/25114 )

Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................


Patch Set 1: Code-Review+2

Thanks for fixing this!


-- 
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: comment
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 1
Gerrit-Owner: Xianqing He <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 11:39:21 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25114 )

Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................


Patch Set 2:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/14266/ DRY_RUN=false


-- 
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: comment
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 2
Gerrit-Owner: Xianqing He <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 11:40:50 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Balazs Hevele (Code Review)" <ge...@cloudera.org>.
Balazs Hevele has posted comments on this change. ( http://gerrit.cloudera.org:8080/25114 )

Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................


Patch Set 1: Code-Review+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: comment
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 1
Gerrit-Owner: Xianqing He <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 11:17:17 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25114 )

Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................


Patch Set 2: Code-Review+2


-- 
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: comment
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 2
Gerrit-Owner: Xianqing He <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 11:40:49 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
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 <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
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 <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>

[Impala-ASF-CR] IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25114 )

Change subject: IMPALA-15547: Fix LIKE pattern truncation at embedded NUL bytes
......................................................................


Patch Set 2: Verified+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: comment
Gerrit-Change-Id: Idf91f8bfdb8b8a1e6510b788bd6fbd70edcc3704
Gerrit-Change-Number: 25114
Gerrit-PatchSet: 2
Gerrit-Owner: Xianqing He <he...@126.com>
Gerrit-Reviewer: Balazs Hevele <bh...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 16:23:38 +0000
Gerrit-HasComments: No