jingzhang created FLINK-6067:
--------------------------------

             Summary: ProjectNode and FilterNode cannot merge in Batch TableAPI
                 Key: FLINK-6067
                 URL: https://issues.apache.org/jira/browse/FLINK-6067
             Project: Flink
          Issue Type: Bug
          Components: Table API & SQL
            Reporter: jingzhang
            Assignee: jingzhang


{code}
    val table1 = tEnv.scan( "tb1")
    val table2 = tEnv.scan("tb2")
    val result = table2
        .where("d < 3")
        .select('d *2, 'e, 'g.upperCase())
        .unionAll(table1.select('a *2, 'b, 'c.upperCase()))
{code}
we run the above code in the BatchTableAPI, we would get the following 
optimizedPlan
{code}
DataSetUnion(union=[_c0, e, _c2])
DataSetCalc(select=[*(d, 2) AS _c0, e, UPPER(g) AS _c2])
DataSetCalc(select=[d, e, g], where=[<(d, 3)])
BatchTableSourceScan(table=[[tb2]], fields=[d, e, g])
DataSetCalc(select=[*(a, 2) AS _c0, b, UPPER(c) AS _c2])
BatchTableSourceScan(table=[[tb1]], fields=[a, b, c])
{code}
However, we run the above code in the Stream TableAPI, we would get the 
following optimizedPlan
{code}
DataStreamUnion(union=[_c0, e, _c2])
DataStreamCalc(select=[*(d, 2) AS _c0, e, UPPER(g) AS _c2], where=[<(d, 3)])
StreamTableSourceScan(table=[[test, db2, tb2]], fields=[d, e, g])
DataStreamCalc(select=[*(a, 2) AS _c0, b, UPPER(c) AS _c2])
StreamTableSourceScan(table=[[test, db1, tb1]], fields=[a, b, c])
{code}

we can find that in the batch tableAPI, the project and filterNode don't merge 
into a single node. However, in the Stream tableAPI, these two nodes could 
merge into one.



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

Reply via email to