You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "LeoWangLZ (JIRA)" <ji...@apache.org> on 2017/12/26 05:52:00 UTC

[jira] [Comment Edited] (CALCITE-2111) HepPlanner apply more and more rules

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

LeoWangLZ edited comment on CALCITE-2111 at 12/26/17 5:51 AM:
--------------------------------------------------------------

Thanks [~julianhyde]
The advantages are decreasing the rule apply that has no transformation, and Contrast to other mode, it is the most efficient. For my test, rule applied decrease some orders of magnitude.  The query contains more and more union all, it can reduce more rule apply. so for complex query it has more efficient.
And it has no other disadvantages compared with other modes.
When I fix the bug, I think whether we need to modify the implementation of ARBITRARY Order that is most efficient compared to other two, or add new mode, but I choose the latter.


was (Author: perid007):
Thanks [~julianhyde]
The advantages are decreasing the rule apply that has no transformation, and Contrast to other mode, the count of apply rule is the most efficient. For my test, rule applied decrease some orders of magnitude.  The query contains more and more union all, it can reduce more rule apply. so for complex query it has more efficient.
And it has no other disadvantages compared with other modes.
When I fix the bug, I think whether we need to modify the implementation of ARBITRARY Order that is most efficient compared to other two, or add new mode, but I choose the latter.

> HepPlanner apply more and more rules
> ------------------------------------
>
>                 Key: CALCITE-2111
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2111
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.15.0
>            Reporter: LeoWangLZ
>            Assignee: Julian Hyde
>
> HepPlanner#applyRules will fully restart after transformation.
> if the rule for the inner relNode happens transformation, then the previous all relNode will be apply for all rules again. and the accumulated rule apply will be exploded as rule apply.
> like query that it contains hundreds of  union all
> {code:java}
> select * from (
> 	select ENAME, 50011895 as cat_id, '1' as cat_name, 1 as require_free_postage, 0 as  require_15return, 0 as require_48hour,1 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50011895 union all
> 	select ENAME, 50013023 as cat_id, '2' as cat_name, 0 as require_free_postage, 0 as  require_15return, 0 as require_48hour,0 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50013023 union all
> 	select ENAME, 50013032 as cat_id, '3' as cat_name, 0 as require_free_postage, 0 as  require_15return, 0 as require_48hour,0 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50013032 union all
> 	select ENAME, 50013024 as cat_id, '4' as cat_name, 0 as require_free_postage, 0 as  require_15return, 0 as require_48hour,0 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50013024 union all
> 	select ENAME, 50004204 as cat_id, '5' as cat_name, 0 as require_free_postage, 0 as  require_15return, 0 as require_48hour,0 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50004204 union all
> 	select ENAME, 50013043 as cat_id, '6' as cat_name, 0 as require_free_postage, 0 as  require_15return, 0 as require_48hour,0 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50013043 union all
> 	select ENAME, 290903 as cat_id, '7' as cat_name, 1 as require_free_postage, 0 as  require_15return, 0 as require_48hour,1 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 290903 union all
> 	select ENAME, 50008261 as cat_id, '8' as cat_name, 1 as require_free_postage, 0 as  require_15return, 0 as require_48hour,1 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 50008261 union all
> 	select ENAME, 124478013 as cat_id, '9' as cat_name, 0 as require_free_postage, 0 as  require_15return, 1 as require_48hour,0 as  require_insurance from emp where EMPNO = 20171216 and MGR = 0 and ENAME = 'Y' and SAL = 124478013 union all
> ...
> )a;
> {code} 
> For rules ReduceExpressionsRule.FILTER_INSTANCE and ReduceExpressionsRule.PROJECT_INSTANCE,  it apply 1W+ rules.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)