Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2111

Make HepPlanner more efficient by applying rules depth-first

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.15.0
    • 1.16.0
    • None
    • None

    Description

      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

      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;
      

      For rules ReduceExpressionsRule.FILTER_INSTANCE and ReduceExpressionsRule.PROJECT_INSTANCE, it apply 1W+ rules.

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            perid007 LeoWangLZ
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: