[
https://issues.apache.org/jira/browse/CALCITE-7578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18086284#comment-18086284
]
Sergey Nuyanzin commented on CALCITE-7578:
------------------------------------------
Thank you for the review [~xuzifu666]
> LIKE with empty ESCAPE might fail with StringIndexOutOfBoundsException
> ----------------------------------------------------------------------
>
> Key: CALCITE-7578
> URL: https://issues.apache.org/jira/browse/CALCITE-7578
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Sergey Nuyanzin
> Assignee: Sergey Nuyanzin
> Priority: Major
> Labels: pull-request-available
>
> If pattern under {{LIKE}} is not {{%}} and {{ESCAPE}} is empty for instance
> {code:sql}
> 'str' LIKE 'a' ESCAPE ''
> {code}
> Then it fails as
> {noformat}
> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
> at java.lang.String.charAt(String.java:658)
> at org.apache.calcite.rex.RexLiteral.getValueAs(RexLiteral.java:1094)
> at org.apache.calcite.rex.RexSimplify.simplifyLike(RexSimplify.java:532)
> at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:322)
> at
> org.apache.calcite.rex.RexSimplify.simplifyUnknownAs(RexSimplify.java:256)
> {noformat}
> it should not fail while {{RegSimplify}}, and message should be more human
> friendly
--
This message was sent by Atlassian Jira
(v8.20.10#820010)