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

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

Sergey Nuyanzin created CALCITE-7578:
----------------------------------------

             Summary: 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


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)