Skip to content

fix: support explicit LIKE ESCAPE semantics - #26429

Merged
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-23104-like-escape
Jul 30, 2026
Merged

mergify[bot] merged 4 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-23104-like-escape

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Jul 30, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #23104

What this PR does / why we need it:

MatrixOne parses LIKE ... ESCAPE but previously drops the ESCAPE expression during binding, so custom escapes and prepared ESCAPE parameters do not affect execution.

This change:

  • threads ESCAPE through LIKE, NOT LIKE, ILIKE, and NOT ILIKE binding;
  • adds three-argument LIKE/ILIKE overloads while preserving the existing two-argument path;
  • accepts empty or one Unicode escape character, treats NULL ESCAPE as disabled escaping without suppressing NULL propagation from the value or pattern, and rejects nonconstant or multi-character ESCAPE values with Incorrect arguments to ESCAPE;
  • rejects empty ESCAPE under execution-time NO_BACKSLASH_ESCAPES, using the live resolver with serialized SessionInfo fallback for remote execution, while NULL ESCAPE bypasses this explicit-empty validation;
  • recognizes an ILIKE escape before case folding;
  • skips the two-argument prefix optimization for explicit ESCAPE predicates;
  • preserves the third ESCAPE argument in EXPLAIN for direct and NOT-wrapped LIKE/ILIKE expressions.

The execution-time constant requirement and NULL ESCAPE behavior follow MySQL 8.4.10. Prepared parameters are accepted; row-dependent column escapes are rejected.

Validation

  • old implementation reproduction: binder regression failed because LIKE retained only two arguments;
  • review reproduction on exact head a72938624: the new NULL ESCAPE SQL-mode regression failed with expected true, got NULL;
  • focused binder, matcher, vector evaluator, SQL-mode, NULL ESCAPE, EXPLAIN, and invalid-arity tests: PASS;
  • seven exact focused tests, each independently run with -race -count=100: PASS;
  • full pkg/sql/plan, pkg/sql/plan/function, and pkg/sql/plan/explain with -race -count=1: PASS;
  • go build and go vet for all three owning packages: PASS;
  • git diff --check: PASS;
  • CR Learning Gate preflight: PASS review=PASS validation=PENDING on rebased head c05ddd0b9ea5bfaf7d40021111cc50378480eb33, diff hash 70b4859a3f1be8b732257edd45cfbb89cddea8dca9a8d8ebfcfe2caaa8850954.

BVT coverage is added to test/distributed/cases/operator/like_operator.sql, including direct and prepared NULL ESCAPE under default and NO_BACKSLASH_ESCAPES modes plus the existing prepared statement whose sql_mode changes before execution. The superseded head passed this canonical case 190/190 in PROXY BVT; that job later failed on an unrelated pitr_basic.sql DROP ACCOUNT 300-second timeout, and Coverage failed only because its producer failed. The branch was cleanly rebased onto current upstream/main; fresh exact-head CI remains pending. The PR remains Ready for Review.

QA handoff

  • QA required: yes — user-visible MySQL compatibility behavior.
  • Production entrypoint: SQL LIKE/NOT LIKE/ILIKE/NOT ILIKE with explicit ESCAPE, including prepared ESCAPE parameters and NO_BACKSLASH_ESCAPES.
  • Automated terminal coverage: canonical operator BVT plus binder, vector execution, SQL-mode, NULL ESCAPE, and EXPLAIN unit tests.
  • Remaining validation: exact-head CI/BVT, then QA comparison against MySQL for custom, empty, Unicode, NULL, prepared, SQL-mode, and invalid ESCAPE cases.
  • Closure policy: after merge, assign to QA and move the issue to testing; close only after QA verifies the deployed build.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the exact latest head. The previous ESCAPE NULL blocker is closed: NULL disables escaping without suppressing NULL propagation from value/pattern or triggering explicit-empty SQL-mode validation. I also checked NOT LIKE/NOT ILIKE binding, ILIKE case-fold ordering, explicit-escape optimizer bypass, explain output, prepared parameters, and remote/session SQL-mode fallback. Full pkg/sql/plan/function, pkg/sql/plan/explain, and pkg/sql/plan tests pass locally; current CI is green.

@mergify mergify Bot added the queued label Jul 30, 2026
@mergify

mergify Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-30 10:44 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-30 12:10 UTC · at 7f8447f1daf8884fc06d9655e9a542f89c88fe55 · squash

This pull request spent 1 hour 26 minutes 32 seconds in the queue, including 59 minutes 47 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

@mergify
mergify Bot merged commit 11eaec8 into matrixorigin:main Jul 30, 2026
25 of 26 checks passed
@mergify mergify Bot removed the queued label Jul 30, 2026
@VioletQwQ-0
VioletQwQ-0 deleted the codex/issue-23104-like-escape branch July 30, 2026 12:18
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
MatrixOne parses `LIKE ... ESCAPE` but previously drops the ESCAPE expression during binding, so custom escapes and prepared ESCAPE parameters do not affect execution.

This change:

- threads ESCAPE through LIKE, NOT LIKE, ILIKE, and NOT ILIKE binding;
- adds three-argument LIKE/ILIKE overloads while preserving the existing two-argument path;
- accepts empty or one Unicode escape character, treats NULL ESCAPE as disabled escaping without suppressing NULL propagation from the value or pattern, and rejects nonconstant or multi-character ESCAPE values with `Incorrect arguments to ESCAPE`;
- rejects empty ESCAPE under execution-time `NO_BACKSLASH_ESCAPES`, using the live resolver with serialized `SessionInfo` fallback for remote execution, while NULL ESCAPE bypasses this explicit-empty validation;
- recognizes an ILIKE escape before case folding;
- skips the two-argument prefix optimization for explicit ESCAPE predicates;
- preserves the third ESCAPE argument in EXPLAIN for direct and NOT-wrapped LIKE/ILIKE expressions.

The execution-time constant requirement and NULL ESCAPE behavior follow MySQL 8.4.10. Prepared parameters are accepted; row-dependent column escapes are rejected.

Approved by: @heni02, @XuPeng-SH
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
MatrixOne parses `LIKE ... ESCAPE` but previously drops the ESCAPE expression during binding, so custom escapes and prepared ESCAPE parameters do not affect execution.

This change:

- threads ESCAPE through LIKE, NOT LIKE, ILIKE, and NOT ILIKE binding;
- adds three-argument LIKE/ILIKE overloads while preserving the existing two-argument path;
- accepts empty or one Unicode escape character, treats NULL ESCAPE as disabled escaping without suppressing NULL propagation from the value or pattern, and rejects nonconstant or multi-character ESCAPE values with `Incorrect arguments to ESCAPE`;
- rejects empty ESCAPE under execution-time `NO_BACKSLASH_ESCAPES`, using the live resolver with serialized `SessionInfo` fallback for remote execution, while NULL ESCAPE bypasses this explicit-empty validation;
- recognizes an ILIKE escape before case folding;
- skips the two-argument prefix optimization for explicit ESCAPE predicates;
- preserves the third ESCAPE argument in EXPLAIN for direct and NOT-wrapped LIKE/ILIKE expressions.

The execution-time constant requirement and NULL ESCAPE behavior follow MySQL 8.4.10. Prepared parameters are accepted; row-dependent column escapes are rejected.

Approved by: @heni02, @XuPeng-SH
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
MatrixOne parses `LIKE ... ESCAPE` but previously drops the ESCAPE expression during binding, so custom escapes and prepared ESCAPE parameters do not affect execution.

This change:

- threads ESCAPE through LIKE, NOT LIKE, ILIKE, and NOT ILIKE binding;
- adds three-argument LIKE/ILIKE overloads while preserving the existing two-argument path;
- accepts empty or one Unicode escape character, treats NULL ESCAPE as disabled escaping without suppressing NULL propagation from the value or pattern, and rejects nonconstant or multi-character ESCAPE values with `Incorrect arguments to ESCAPE`;
- rejects empty ESCAPE under execution-time `NO_BACKSLASH_ESCAPES`, using the live resolver with serialized `SessionInfo` fallback for remote execution, while NULL ESCAPE bypasses this explicit-empty validation;
- recognizes an ILIKE escape before case folding;
- skips the two-argument prefix optimization for explicit ESCAPE predicates;
- preserves the third ESCAPE argument in EXPLAIN for direct and NOT-wrapped LIKE/ILIKE expressions.

The execution-time constant requirement and NULL ESCAPE behavior follow MySQL 8.4.10. Prepared parameters are accepted; row-dependent column escapes are rejected.

Approved by: @heni02, @XuPeng-SH

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants