You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Sergey Nuyanzin (Jira)" <ji...@apache.org> on 2026/06/05 08:17:00 UTC

[jira] [Commented] (CALCITE-7578) LIKE with empty ESCAPE might fail with StringIndexOutOfBoundsException

    [ https://issues.apache.org/jira/browse/CALCITE-7578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18086283#comment-18086283 ] 

Sergey Nuyanzin commented on CALCITE-7578:
------------------------------------------

Merged as [be0644381650ea9d43de426bbba469ca51e2f022|https://github.com/apache/calcite/commit/be0644381650ea9d43de426bbba469ca51e2f022]

> 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)