Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
For example, a query such as
select * from (
select t1.deptno, t2.deptno
from emp t1 inner join dept t2
on t1.empno = t2.deptno
)
gives a plan:
LogicalProject(DEPTNO=[$0], DEPTNO0=[$0])
LogicalProject(DEPTNO=[$7], DEPTNO0=[$9])
LogicalJoin(condition=[=($0, $9)], joinType=[inner])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
As the top LogicalProject indicates, although DEPTNO and DEPTNO0 coming from different tables, Calcite thinks they are the same so just pick $0.
Notice if we remove the outermost select * where (), Calcite would not be confused with those two columns.