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

Julian Hyde resolved CALCITE-894.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 1.5.0-incubating

Fixed in 
http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/c6cc5a77. 
Thanks for the PR, [~maryannxue]!

> 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
>             Fix For: 1.5.0-incubating
>
>         Attachments: CALCITE-894.patch, CALCITE-894_2.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)

Reply via email to