Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-6326

add ProjectMergeRule at logical optimization stage

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: Table API & SQL
    • Labels:
      None

      Description

      add ProjectMergeRule to merge projections. Some SQLs can not push projection into scan without this rule.
      e.g.

      table1: id: int, name: string
      table2: id: string, score: double, first: string, last: string

      SELECT a.id, b.score FROM 
       (SELECT id FROM table1 WHERE id > 10) a  
      LEFT OUTER JOIN 
       (SELECT * FROM table2) b 
      ON CAST(a.id AS VARCHAR) = b.id
      
      == Optimized Logical Plan without ProjectMergeRule ==
      DataSetCalc(select=[id, score])
        DataSetJoin(where=[=(id0, id1)], join=[id, id0, id1, score, first, last], joinType=[LeftOuterJoin])
          DataSetCalc(select=[id, CAST(id) AS id0], where=[>(id, 10)])
            BatchTableSourceScan(table=[[table1]], fields=[id])
          BatchTableSourceScan(table=[[table2]], fields=[id, score, first, last])
      
      == Optimized Logical Plan with ProjectMergeRule ==
      DataSetCalc(select=[id, score])
        DataSetJoin(where=[=(id0, id1)], join=[id, id0, id1, score], joinType=[LeftOuterJoin])
          DataSetCalc(select=[id, CAST(id) AS id0], where=[>(id, 10)])
            BatchTableSourceScan(table=[[table1]], fields=[id])
          BatchTableSourceScan(table=[[table2]], fields=[id, score])
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                godfreyhe godfrey he
                Reporter:
                godfreyhe godfrey he
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: