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:
* 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
Example with CHR(INT) function defined as
public static final SqlFunction CHR = SqlBasicFunction.create("CHR", ReturnTypes.CHAR, OperandTypes.INTEGER, SqlFunctionCategory.STRING);
@Test public void test() { sql("SELECT CHR(1000::BIGINT)"); }
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
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).