You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Maryann Xue (JIRA)" <ji...@apache.org> on 2015/09/21 21:56:04 UTC

[jira] [Updated] (CALCITE-894) Do not generate redundant column alias for the left relation when translating IN subquery

     [ https://issues.apache.org/jira/browse/CALCITE-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maryann Xue updated CALCITE-894:
--------------------------------
    Attachment: CALCITE-894.patch

> Do not generate redundant column alias for the left relation when translating IN subquery
> -----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-894
>                 URL: https://issues.apache.org/jira/browse/CALCITE-894
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.4.0-incubating
>            Reporter: Maryann Xue
>            Assignee: Maryann Xue
>            Priority: Minor
>         Attachments: CALCITE-894.patch
>
>
> {code}
> select * from "hr"."emps" where "deptno" in (
>   select "deptno" from "hr"."depts")
> {code}
> would be converted into
> {code}
> LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])
>   LogicalJoin(condition=[=($5, $6)], joinType=[inner])
>     LogicalProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$1])
>       EnumerableTableScan(table=[[hr, emps]])
>     LogicalAggregate(group=[{0}])
>       LogicalProject(deptno=[$0])
>         EnumerableTableScan(table=[[hr, depts]])
> {code}
> There is an additional "$f5=[$1]" in the LogicalProject, which might cause us trouble in the later optimization stage. For example if "emps" table had a collation trait on $1, the Project would have multiple collation traits and would be flattened.
> Instead, we want the converted rel to be like:
> {code}
> LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])
>   LogicalJoin(condition=[=($1, $5)], joinType=[inner])
>     EnumerableTableScan(table=[[hr, emps]])
>     LogicalAggregate(group=[{0}])
>       LogicalProject(deptno=[$0])
>         EnumerableTableScan(table=[[hr, depts]])
> {code}



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