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

Jiajun Xie resolved CALCITE-6191.
---------------------------------
    Resolution: Fixed

> Remove join if input is one row literal
> ---------------------------------------
>
>                 Key: CALCITE-6191
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6191
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jiajun Xie
>            Assignee: Jiajun Xie
>            Priority: Minor
>
> Here are some Join Rules
> {noformat}
> at CoreRules.java | grep ' #JOIN_'
>    * @see #JOIN_REDUCE_EXPRESSIONS
>    * @see #JOIN_SUB_QUERY_TO_CORRELATE */
>    * @see #JOIN_SUB_QUERY_TO_CORRELATE */
>    * @see #JOIN_TO_SEMI_JOIN */
>   /** As {@link #JOIN_COMMUTE} but swaps outer joins as well as inner joins. 
> */
>   /** As {@link #JOIN_PROJECT_BOTH_TRANSPOSE} but only the left input is
>   /** As {@link #JOIN_PROJECT_BOTH_TRANSPOSE} but only the right input is
>   /** As {@link #JOIN_PROJECT_BOTH_TRANSPOSE} but match outer as well as
>   /** As {@link #JOIN_PROJECT_LEFT_TRANSPOSE} but match outer as well as
>   /** As {@link #JOIN_PROJECT_RIGHT_TRANSPOSE} but match outer as well as
>    * @see #JOIN_TO_MULTI_JOIN
> {noformat}
> I cannot optimize the SQL by using them.
> {noformat}
> SELECT EMPNO FROM emp, (SELECT 1 as c) temp WHERE EMPNO = temp.c{noformat}
> Here is optimized RelNode that I want get.
> {code:java}
> LogicalProject(EMPNO=[$0])   
>   LogicalFilter(condition=[=($0, 1)])     
>      LogicalTableScan(table=[[CATALOG, SALES, EMP]]){code}
> But now it is
> {noformat}
> LogicalProject(EMPNO=[$0])
>   LogicalFilter(condition=[=($0, $9)])
>     LogicalJoin(condition=[true], joinType=[inner])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>       LogicalValues(tuples=[[{ 1 }]]){noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to