You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Sean Hsuan-Yi Chu (JIRA)" <ji...@apache.org> on 2016/03/14 22:29:33 UTC
[jira] [Created] (CALCITE-1154) Wrong Plan/Result if wrapping a
query with SELECT * FROM
Sean Hsuan-Yi Chu created CALCITE-1154:
------------------------------------------
Summary: Wrong Plan/Result if wrapping a query with SELECT * FROM
Key: CALCITE-1154
URL: https://issues.apache.org/jira/browse/CALCITE-1154
Project: Calcite
Issue Type: Bug
Components: core
Reporter: Sean Hsuan-Yi Chu
Assignee: Sean Hsuan-Yi Chu
For example, a query such as
{code}
select * from (
select t1.deptno, t2.deptno
from emp t1 inner join dept t2
on t1.empno = t2.deptno
)
{code}
gives a plan:
{code}
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]])
{code}
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)