Skip to content

[FLINK-39402][table] Fix LIKE quick path ignoring default escape character '\'#27898

Open
Au-Miner wants to merge 1 commit intoapache:masterfrom
Au-Miner:FLINK-39402
Open

[FLINK-39402][table] Fix LIKE quick path ignoring default escape character '\'#27898
Au-Miner wants to merge 1 commit intoapache:masterfrom
Au-Miner:FLINK-39402

Conversation

@Au-Miner
Copy link
Copy Markdown
Contributor

@Au-Miner Au-Miner commented Apr 6, 2026

What is the purpose of the change

Fix the default escape character \ not being applied in LIKE's quick path when no ESCAPE clause is specified, causing 'TE%ST' LIKE 'TE\%ST' to incorrectly return FALSE while 'TE_ST' LIKE 'TE\_ST' correctly returns TRUE.

Brief change log

  • Unified escape character handling in LikeCallGen for both 2-operand and 3-operand cases using Option[Char]
  • Added test cases for default escape \ and empty ESCAPE scenarios in ScalarFunctionsTest

Verifying this change

This change is verified by new and existing tests in ScalarFunctionsTest#testLike and ScalarFunctionsTest#testLikeWithEscape.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented Apr 6, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Copy Markdown
Contributor

@raminqaf raminqaf left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @Au-Miner! I left a comment for a test case!

testAllApis("abd".like("abc", ""), "'abd' LIKE 'abc' ESCAPE ''", "FALSE")
testAllApis("abcdef".like("abc%", ""), "'abcdef' LIKE 'abc%' ESCAPE ''", "TRUE")
testAllApis("abcdef".like("%def", ""), "'abcdef' LIKE '%def' ESCAPE ''", "TRUE")
testAllApis("abcdef".like("%cd%", ""), "'abcdef' LIKE '%cd%' ESCAPE ''", "TRUE")
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.

Can we add a test for this case please

'abc_def' LIKE 'abc_def' ESCAPE ''

@github-actions github-actions bot added the community-reviewed PR has been reviewed by the community. label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants