calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Hyde (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CALCITE-1649) Data type mismatch in EnumerableMergeJoin
Date Mon, 20 Feb 2017 20:33:44 GMT
Julian Hyde created CALCITE-1649:
------------------------------------

             Summary: Data type mismatch in EnumerableMergeJoin
                 Key: CALCITE-1649
                 URL: https://issues.apache.org/jira/browse/CALCITE-1649
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


In plans that use EnumerableMergeJoin, if the keys have different types you can get a runtime
exception. After the fix for CALCITE-1634 one particular query in {{sub-query.iq}} stopped
using EnumerableSemiJoin and started using EnumerableMergeJoin (following the realization
that a single-row Values was trivially sorted):

{noformat}
with t (a, b) as (select * from (values (60, 'b')))
select * from t where a in (select deptno from "scott".dept);
EnumerableCalc(expr#0..2=[{inputs}], A=[$t1], B=[$t2])
  EnumerableMergeJoin(condition=[=($0, $1)], joinType=[inner])
    EnumerableCalc(expr#0..2=[{inputs}], DEPTNO=[$t0])
      EnumerableTableScan(table=[[scott, DEPT]])
    EnumerableValues(tuples=[[{ 60, 'b' }]])
!plan
java.sql.SQLException: Error while executing SQL "with t (a, b) as (select * from (values
(60, 'b')))
select * from t where a in (select deptno from "scott".dept)
": java.lang.Integer cannot be cast to java.lang.Byte
	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
	at net.hydromatic.quidem.Quidem$CheckResultCommand.execute(Quidem.java:830)
	at net.hydromatic.quidem.Quidem$CompositeCommand.execute(Quidem.java:1450)
	at net.hydromatic.quidem.Quidem.execute(Quidem.java:197)
	at org.apache.calcite.test.QuidemTest.checkRun(QuidemTest.java:165)
	at org.apache.calcite.test.QuidemTest.testSqlDummy(QuidemTest.java:246)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.calcite.test.QuidemTest.test(QuidemTest.java:215)
	at org.apache.calcite.test.QuidemTest.main(QuidemTest.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte
	at java.lang.Byte.compareTo(Byte.java:44)
	at org.apache.calcite.linq4j.EnumerableDefaults$MergeJoinEnumerator.advance(EnumerableDefaults.java:3257)
	at org.apache.calcite.linq4j.EnumerableDefaults$MergeJoinEnumerator.start(EnumerableDefaults.java:3242)
	at org.apache.calcite.linq4j.EnumerableDefaults$MergeJoinEnumerator.<init>(EnumerableDefaults.java:3236)
	at org.apache.calcite.linq4j.EnumerableDefaults$13.enumerator(EnumerableDefaults.java:1406)
	at Baz$5$1.<init>(Unknown Source)
	at Baz$5.enumerator(Unknown Source)
	at org.apache.calcite.linq4j.AbstractEnumerable.iterator(AbstractEnumerable.java:33)
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message