Maksim Zhuravkov created IGNITE-20721:
-----------------------------------------
Summary: Sql. Type mismatch errors for numeric types in function
calls leak into runtime.
Key: IGNITE-20721
URL: https://issues.apache.org/jira/browse/IGNITE-20721
Project: Ignite
Issue Type: Bug
Components: sql
Reporter: Maksim Zhuravkov
Example:
{code:java}
sql("SELECT ROUND(1.12, 1::DECIMAL(1))");
# SqlValidatorException: Cannot apply 'ROUND' to arguments of type
'ROUND(<DECIMAL(3, 2)>, <DECIMAL(1, 0)>)'. Supported form(s): 'ROUND(<NUMERIC>,
<INTEGER>)'
SELECT ROUND(1.123, 1::BIGINT)
{code}
But this example produces a runtime error:
{code:java}
sql("SELECT ROUND(1.12, 1::BIGINT)");
# NoSuchMethodException:
org.apache.ignite.internal.sql.engine.exec.exp.IgniteSqlFunctions.sround(java.math.BigDecimal,
long)
{code}
SUBSTRING function is also affected by this error:
{code:java}
sql("SELECT SUBSTRING('1234', 1::BIGINT)")
# NoSuchMethodException:
org.apache.calcite.runtime.SqlFunctions.substring(java.lang.String, long)
sql("SELECT SUBSTRING('1234', 1::DECIMAL(1))")
# NoSuchMethodException:
org.apache.calcite.runtime.SqlFunctions.substring(java.lang.String,
java.math.BigDecimal)
{code}
Probably other functions, that accept values that lie in the domain of INT
type, are affected as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)