[ 
https://issues.apache.org/jira/browse/CALCITE-6891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17935754#comment-17935754
 ] 

Julian Hyde commented on CALCITE-6891:
--------------------------------------

This rule will only do the right thing under CBO if LogicalIntersect has a cost 
function that gives a lower cost if smaller inputs are first. Does it currently 
have such a cost function?

> Implement IntersectReorderRule
> ------------------------------
>
>                 Key: CALCITE-6891
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6891
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Zhen Chen
>            Assignee: Zhen Chen
>            Priority: Major
>
> Do we need this rule?
> from:
>  
> {code:java}
> LogicalIntersect(all=[false])
>   LogicalProject(DEPTNO=[$7])
>     LogicalFilter(condition=[>($7, 10)])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP(big)]])
>   LogicalProject(DEPTNO=[$0])
>     LogicalFilter(condition=[>($0, 5)])
>       LogicalTableScan(table=[[CATALOG, SALES, DEPT(small)]]){code}
> to
>  
>  
> {code:java}
> LogicalIntersect(all=[false])
>   LogicalProject(DEPTNO=[$0])
>     LogicalFilter(condition=[>($0, 5)])
>       LogicalTableScan(table=[[CATALOG, SALES, DEPT(small)]])
>   LogicalProject(DEPTNO=[$7])
>     LogicalFilter(condition=[>($7, 10)])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP(big)]]) {code}
> This rule put smaller inputs first. This helps reduce the size of 
> intermediate results.
>  



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

Reply via email to