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

Maksim Zhuravkov updated IGNITE-23242:
--------------------------------------
    Description: 
The following functions when called with BIGINT arguments at integer positions 
are accepted by the validator, but execution of such functions fails with 
runtime errors:

{code:java}
 * OVERLAY: while resolving method 'overlay
 * REPEAT: while resolving method 'repeat
 * SUBSTRING:  while resolving method 'substring
 * CHR: while resolving method 'charFromUtf8
 * LEFT:  while resolving method 'left
 * RIGHT: while resolving method 'right
 * SPACE:  while resolving method  in class class ...
 * POSITION:  while resolving method 'position
{code}

Example with CHR(INT) function. 

{code:java}
   @Test
    public void test() {
        sql("SELECT CHR(1000::BIGINT)");
    }
{code}

{noformat}
org.apache.ignite.sql.SqlException: IGN-CMN-65535 
TraceId:6002aa38-1fae-4e4e-b56c-a8134d3ed2dc while resolving method 
'charFromUtf8[long]' in class class org.apache.calcite.runtime.SqlFunctions

        ....

Caused by: java.lang.NoSuchMethodException: 
org.apache.calcite.runtime.SqlFunctions.charFromUtf8(long)
        at java.base/java.lang.Class.getMethod(Class.java:2108)
        at 
org.apache.calcite.adapter.enumerable.EnumUtils.call(EnumUtils.java:663)
        ... 37 more
{noformat}

The problem stems from the fact that these functions, according to their 
definitions in the operator table, accept parameters from the INTEGER type 
family, which includes the BIGINT type. However, the runtime definition for 
such functions lacks implementations that accept parameters of the long type 
(which corresponds to Calcite’s BIGINT).




  was:
The following functions when called with BIGINT arguments at integer positions 
are accepted by the validator, but execution of such functions fails with 
runtime errors

{code:java}
 * OVERLAY: while resolving method 'overlay
 * REPEAT: while resolving method 'repeat
 * SUBSTRING:  while resolving method 'substring
 * CHR: while resolving method 'charFromUtf8
 * LEFT:  while resolving method 'left
 * RIGHT: while resolving method 'right
 * SPACE:  while resolving method  in class class ...
 * POSITION:  while resolving method 'position
{code}

Example with CHR(INT) function. 

{code:java}
   @Test
    public void test() {
        sql("SELECT CHR(1000::BIGINT)");
    }
{code}


{noformat}
org.apache.ignite.sql.SqlException: IGN-CMN-65535 
TraceId:6002aa38-1fae-4e4e-b56c-a8134d3ed2dc while resolving method 
'charFromUtf8[long]' in class class org.apache.calcite.runtime.SqlFunctions

        ....

Caused by: java.lang.NoSuchMethodException: 
org.apache.calcite.runtime.SqlFunctions.charFromUtf8(long)
        at java.base/java.lang.Class.getMethod(Class.java:2108)
        at 
org.apache.calcite.adapter.enumerable.EnumUtils.call(EnumUtils.java:663)
        ... 37 more
{noformat}



> Sql. Validator accepts functions that do not exist in runtime. It is not 
> possible to call f(INTEGER) with f(BIGINT)
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-23242
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23242
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> The following functions when called with BIGINT arguments at integer 
> positions are accepted by the validator, but execution of such functions 
> fails with runtime errors:
> {code:java}
>  * OVERLAY: while resolving method 'overlay
>  * REPEAT: while resolving method 'repeat
>  * SUBSTRING:  while resolving method 'substring
>  * CHR: while resolving method 'charFromUtf8
>  * LEFT:  while resolving method 'left
>  * RIGHT: while resolving method 'right
>  * SPACE:  while resolving method  in class class ...
>  * POSITION:  while resolving method 'position
> {code}
> Example with CHR(INT) function. 
> {code:java}
>    @Test
>     public void test() {
>         sql("SELECT CHR(1000::BIGINT)");
>     }
> {code}
> {noformat}
> org.apache.ignite.sql.SqlException: IGN-CMN-65535 
> TraceId:6002aa38-1fae-4e4e-b56c-a8134d3ed2dc while resolving method 
> 'charFromUtf8[long]' in class class org.apache.calcite.runtime.SqlFunctions
>       ....
> Caused by: java.lang.NoSuchMethodException: 
> org.apache.calcite.runtime.SqlFunctions.charFromUtf8(long)
>       at java.base/java.lang.Class.getMethod(Class.java:2108)
>       at 
> org.apache.calcite.adapter.enumerable.EnumUtils.call(EnumUtils.java:663)
>       ... 37 more
> {noformat}
> The problem stems from the fact that these functions, according to their 
> definitions in the operator table, accept parameters from the INTEGER type 
> family, which includes the BIGINT type. However, the runtime definition for 
> such functions lacks implementations that accept parameters of the long type 
> (which corresponds to Calcite’s BIGINT).



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

Reply via email to