Miguel Oliveira created CALCITE-1382:
----------------------------------------

             Summary: CastException in JDBC Adapter
                 Key: CALCITE-1382
                 URL: https://issues.apache.org/jira/browse/CALCITE-1382
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.9.0
         Environment: This bug was detected using a postgresql database and the 
calcite version 1.9.0.
            Reporter: Miguel Oliveira
            Assignee: Julian Hyde
             Fix For: 1.10.0


This query:
{code}
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)
{code}

generates a CastException: "org.apache.calcite.adapter.jdbc.JdbcRules$JdbcJoin 
cannot be cast to org.apache.calcite.adapter.enumerable.EnumerableRel".

The plan is the following:
{code}
[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]])
, }]
{code}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to