Aleksey Plekhanov created IGNITE-23435:
------------------------------------------

             Summary: Calcite engine. Cached compiled expression for correlated 
variable can have different data type
                 Key: IGNITE-23435
                 URL: https://issues.apache.org/jira/browse/IGNITE-23435
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov
            Assignee: Aleksey Plekhanov


Reproducer:

{code:java}
    @Test
    public void testCorrelatesDifferentDataType() {
        for (String type : new String[] {"INTEGER", "TINYINT"}) {
            try {
                sql("CREATE TABLE t1(v INTEGER)");
                sql("CREATE TABLE t2(v " + type + ")");
                sql("INSERT INTO t1 VALUES (1)");
                sql("INSERT INTO t2 VALUES (1)");

                assertQuery("SELECT (SELECT t1.v + t2.v FROM t1) FROM t2")
                    .returns(2)
                    .check();
            }
            finally {
                sql("DROP TABLE t1");
                sql("DROP TABLE t2");
            }
        }
    }
{code}
Fails with:

{noformat}
Caused by: java.lang.ClassCastException: class java.lang.Byte cannot be cast to 
class java.lang.Integer (java.lang.Byte and java.lang.Integer are in module 
java.base of loader 'bootstrap')
        at SC.execute(Unknown Source)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.exp.ExpressionFactoryImpl$ProjectImpl.apply(ExpressionFactoryImpl.java:668)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.rel.ProjectNode.push(ProjectNode.java:63)
...
{noformat}




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

Reply via email to