[
https://issues.apache.org/jira/browse/FLINK-39402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18072951#comment-18072951
]
Qilong Wang commented on FLINK-39402:
-------------------------------------
[~twalthr] Yes, I plan to fix the default escape character '\' set in
FLINK-36100 and set no default escape character unless using the ESCAPE clause
> Fix LIKE quick path ignoring default escape character '\'
> ---------------------------------------------------------
>
> Key: FLINK-39402
> URL: https://issues.apache.org/jira/browse/FLINK-39402
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 2.3.0
> Reporter: Qilong Wang
> Priority: Major
> Labels: pull-request-available
> Attachments: Screenshot 2026-04-07 at 14.15.23.png
>
>
> The LIKE expression uses \ as the default escape character when no ESCAPE
> clause is specified(FLINK-36100). However, the quick path for 2-operand LIKE
> did not apply escape handling at all. Only \_ happened to produce correct
> results, while all other escape sequences were broken:
> {code:java}
> – \ escapes '' to match a literal '' — correct
> SELECT 'TE_ST' LIKE 'TE_ST'
> – \ escapes % to match a literal % — should be TRUE, but returns FALSE
> SELECT 'TE%ST' LIKE 'TE\%ST'
> – \ followed by invalid character S — should throw RuntimeException, but
> returns FALSE
> SELECT 'TEST' LIKE '%E\S%'
> – \ at the end of pattern — should throw RuntimeException, but returns FALSE
> SELECT 'TEST' LIKE '%E-S%\'{code}
> The fix unifies escape handling for both 2-operand (no ESCAPE clause) and
> 3-operand LIKE expressions, ensuring the default escape character \ is
> properly applied in the quick path.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)