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

Avoid pushing down join condition in SqlToRelConverter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.24.0
    • None
    • None

    Description

      In current code, SqlToRelConverter:createJoin is calling RelOptUtil.pushDownJoinConditions for optimization. And we can find below conversion from SqlNode to RelNode:

      SqlNode:
      select * from A join B on A.x = B.x * 2
      
      RelNode (Logical-Plan):
      Join (condition:col0=col1)
      |-Project(x as col0)
      | |-Scan(A)
      |-Project(x * 2 as col1)
        |-Scan(B)

      As we can see the logical plan(RelNode) posted above is not the pure reflection of the original SQL String(SqlNode). The optimization is mixed into the phase on which AST is converted to Logical-Plan. Actually optimizing rule of JoinPushExpressionsRule is doing exactly the same kind of thing. Shall we just keep the optimization inside Optimized-Logical-Plan ? I mean shall we avoid calling RelOptUtil.pushDownJoinConditions in SqlToRelConverter:createJoin

      I raised this issue because that we are doing something based on the Logical-Plan. And it makes us really confused that the Logical-Plan doesn't corresponds to SqlNode. 

       

       

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            jinxing6042@126.com Jin Xing
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: