Skip to content

[BugFix] Fix LIKE escaping mismatch with MySQL in constant folding (backport #74814)#75000

Open
Joob1n wants to merge 2 commits into
StarRocks:branch-3.5from
Joob1n:backport/branch-3.5/pr-74814
Open

[BugFix] Fix LIKE escaping mismatch with MySQL in constant folding (backport #74814)#75000
Joob1n wants to merge 2 commits into
StarRocks:branch-3.5from
Joob1n:backport/branch-3.5/pr-74814

Conversation

@Joob1n

@Joob1n Joob1n commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing:

StarRocks is compatible with MySQL 8, but WHERE-LIKE with constant items produces different results.

select 'a\\b' like 'a\\\\b';
MySQL: 1
StarRocks: 0

select 'a\\b' like 'a\\b';
MySQL: 0
StarRocks: 1

What I'm doing:

Add the 2nd-layer escape operator when FE handle the WHERE-LIKE with constant items.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5

…ymbols

The cherry-pick pulled in main's type-package migration (com.starrocks.type.*),
which does not exist on branch-3.5:
  - FoldConstantsRule.java: remove the 7 duplicate com.starrocks.type.* imports
    and revert BooleanType.BOOLEAN back to catalog Type.BOOLEAN.
  - FoldConstantsRuleTest.java: VarcharType.VARCHAR -> Type.VARCHAR (catalog).
No behavior change to the LIKE escaping fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant