Aleksey Plekhanov created IGNITE-23673:
------------------------------------------

             Summary: Calcite engine. Functions NVL and DECODE fail when used 
with parameters of different data types 
                 Key: IGNITE-23673
                 URL: https://issues.apache.org/jira/browse/IGNITE-23673
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov
            Assignee: Aleksey Plekhanov


For example:

{code:java}
select nvl('1', 2)
{code}
Fails with:
{noformat}
Cannot infer return type for NVL; operand types: [VARCHAR, INTEGER]
{noformat}

{code:java}
select decode('1', 1, '1', '2')
{code}
Fails with:
{noformat}
org.apache.ignite.IgniteCheckedException: while resolving method 'eq[class 
java.lang.String, int]' in class class org.apache.calcite.runtime.SqlFunctions
{noformat}

These functions are rewritten to the {{CASE-WHEN}} operator after the 
validation, but fail on validation. But if we use {{CASE-WHEN}} in the original 
query, it works well, types are casted correctly and validation passed:
{code:java}
select case when '1' is not null then '1' else 2 end
select case when '1' = 1 then '1' else '2' end
{code}
 




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

Reply via email to