I have logged https://issues.apache.org/jira/browse/CALCITE-1382 for this issue.
Tomorrow i will try to find a better query. Best regards, Miguel. 2016-09-22 18:55 GMT+01:00 Julian Hyde <[email protected]>: > Yes, sure. Please create a runnable test case if you can. It sounds a bit > improbable as you describe it. > > > On Sep 22, 2016, at 8:44 AM, Miguel Oliveira < > [email protected]> wrote: > > > > Hi, > > > > I'm using the Jdbc Adapter and the SCOTT schema (emp, dept and salgrade). > > > > When i execute the following query (i know that the second join doesn't > > make sense, but it's only to show the error): > > > >> SELECT count(*) FROM (SELECT count(emp.empno) `Count Emp`, dept.dname > >> `Department Name` FROM Calcite.emp emp JOIN Calcite.dept dept ON > emp.deptno > >> = dept.deptno JOIN Calcite.salgrade salgrade ON emp.comm = > salgrade.hisal > >> WHERE dept.dname LIKE '%O%' GROUP BY emp.deptno, dept.dname) > > > > > > a CastException is thrown: > > "org.apache.calcite.adapter.jdbc.JdbcRules$JdbcJoin cannot be cast to > > org.apache.calcite.adapter.enumerable.EnumerableRel". > > > > generates a plan: > > > >> [TABLE, #ID {PLAN=EnumerableAggregate(group=[{}], EXPR$0=[COUNT()]) > >> EnumerableAggregate(group=[{2, 4}]) > >> JdbcJoin(condition=[=($1, $0)], joinType=[inner]) > >> JdbcProject(hisal=[$2]) > >> JdbcTableScan(table=[[Calcite, salgrade]]) > >> JdbcJoin(condition=[=($1, $2)], joinType=[inner]) > >> JdbcProject(comm=[$6], deptno=[$7]) > >> JdbcTableScan(table=[[Calcite, emp]]) > >> JdbcProject(deptno=[$0], dname=[$1]) > >> JdbcFilter(condition=[LIKE($1, '%O%')]) > >> JdbcTableScan(table=[[Calcite, dept]]) > >> , }] > > > > > > Can i create an issue for this? > > > > Best regards, > > Miguel. > >
