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

Upgrade ProjectJoinTransposeRule to allow user choose whether to keep join condition

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • None

    Description

      Currently, when apply ProjectJoinTransposeRule, the join condition may be also pushed, for example
      for sql

      select emp.ename, sum(bonus.sal) from emp left outer join bonus on emp.ename = bonus.ename and floor(emp.sal) > 10 group by emp.ename
      

      the algebra is

      LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])
        LogicalProject(ENAME=[$1], SAL0=[$11])
          LogicalJoin(condition=[AND(=($1, $9), >(FLOOR($5), 10))], joinType=[left])
            LogicalTableScan(table=[[CATALOG, SALES, EMP]])
            LogicalTableScan(table=[[CATALOG, SALES, BONUS]])
      

      After applying ProjectJoinTransposeRule, the join condition 'floor(emp.sal) > 10' is also pushed down,

      LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])
        LogicalProject(ENAME=[$0], SAL0=[$3])
          LogicalJoin(condition=[AND(=($0, $2), $1)], joinType=[left])
            LogicalProject(ENAME=[$1], >=[>(FLOOR($5), 10)])
              LogicalTableScan(table=[[CATALOG, SALES, EMP]])
            LogicalProject(ENAME=[$0], SAL=[$2])
              LogicalTableScan(table=[[CATALOG, SALES, BONUS]])
      

      In some cases, users may want to push Project past Join, but keep the join condition unchanged, so we can upgradeĀ ProjectJoinTransposeRule to allow user choose whether to keep join condition

      Attachments

        Issue Links

          Activity

            People

              yanlin-Lynn Wang Yanlin
              yanlin-Lynn Wang Yanlin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m