Repository navigation
fix: support explicit LIKE ESCAPE semantics - #26429
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
Merge Queue Status
This pull request spent 1 hour 26 minutes 32 seconds in the queue, including 59 minutes 47 seconds running CI. Required conditions to merge
|
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
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
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
What type of PR is this?
Which issue(s) this PR fixes:
issue #23104
What this PR does / why we need it:
MatrixOne parses
LIKE ... ESCAPEbut previously drops the ESCAPE expression during binding, so custom escapes and prepared ESCAPE parameters do not affect execution.This change:
Incorrect arguments to ESCAPE;NO_BACKSLASH_ESCAPES, using the live resolver with serializedSessionInfofallback for remote execution, while NULL ESCAPE bypasses this explicit-empty validation;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
a72938624: the new NULL ESCAPE SQL-mode regression failed withexpected true, got NULL;-race -count=100: PASS;pkg/sql/plan,pkg/sql/plan/function, andpkg/sql/plan/explainwith-race -count=1: PASS;go buildandgo vetfor all three owning packages: PASS;git diff --check: PASS;PASS review=PASS validation=PENDINGon rebased headc05ddd0b9ea5bfaf7d40021111cc50378480eb33, diff hash70b4859a3f1be8b732257edd45cfbb89cddea8dca9a8d8ebfcfe2caaa8850954.BVT coverage is added to
test/distributed/cases/operator/like_operator.sql, including direct and prepared NULL ESCAPE under default andNO_BACKSLASH_ESCAPESmodes plus the existing prepared statement whosesql_modechanges before execution. The superseded head passed this canonical case190/190in PROXY BVT; that job later failed on an unrelatedpitr_basic.sqlDROP ACCOUNT300-second timeout, and Coverage failed only because its producer failed. The branch was cleanly rebased onto currentupstream/main; fresh exact-head CI remains pending. The PR remains Ready for Review.QA handoff
NO_BACKSLASH_ESCAPES.