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

Julian Hyde edited comment on CALCITE-6891 at 3/14/25 6:40 PM:
---------------------------------------------------------------

It is making some assumptions about how Intersect is implemented, and therefore 
seems more like a physical than logical rule. But I agree it would be useful.


was (Author: julianhyde):
It is making some assumptions about how Intersect is implemented, and therefore 
seems more like a physical than logical rule. 

> 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