[ 
https://issues.apache.org/jira/browse/CALCITE-5810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated CALCITE-5810:
------------------------------------
    Labels: pull-request-available  (was: )

> SUBSTRING compile-time evaluation gives wrong result for large lengths
> ----------------------------------------------------------------------
>
>                 Key: CALCITE-5810
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5810
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.34.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>
> This program 
> {code:sql}
> SELECT SUBSTRING('string' FROM 2 FOR 2147483646) 
> {code}
> returns "" instead of "tring".
> This happens because of an overflow in the SqlFunctions substring function:
> {code:java}
> public static String substring(String c, int s, int l) {
>     int lc = c.length();
>     int e = s + l;  // <<<< OVERFLOW here
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to