flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "godfrey he (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLINK-6326) add ProjectMergeRule at logical optimization stage
Date Wed, 19 Apr 2017 09:46:41 GMT
godfrey he created FLINK-6326:
---------------------------------

             Summary: add ProjectMergeRule at logical optimization stage
                 Key: FLINK-6326
                 URL: https://issues.apache.org/jira/browse/FLINK-6326
             Project: Flink
          Issue Type: New Feature
          Components: Table API & SQL
            Reporter: godfrey he
            Assignee: godfrey he


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

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

{code}
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
{code}

{code}
== 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])
{code}

{code}
== 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])
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message