[ https://issues.apache.org/jira/browse/FLINK-6067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
jingzhang updated FLINK-6067: ----------------------------- Description: {code} val result = table.where('a < 60).select('a * 1.2, 'b / 2, 'c) {code} we run the above code in the Batch TableAPI/SQL, we would get the following optimizedPlan {code} DataSetCalc(select=[*(a, 1.2E0) AS _c0, /(b, 2) AS _c1, c]) DataSetCalc(select=[a, b, c], where=[<(a, 60)]) DataSetScan(table=[[_DataSetTable_0]]) {code} However, we run the above code in the Stream TableAPI/SQL, we would get the following optimizedPlan {code} DataStreamCalc(select=[*(a, 1.2E0) AS _c0, /(b, 2) AS _c1, c], where=[<(a, 60)]) DataStreamScan(table=[[_DataStreamTable_0]]) {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. was: {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 Batch TableAPI/SQL, 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/SQL, 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=[[tb2]], fields=[d, e, g]) DataStreamCalc(select=[*(a, 2) AS _c0, b, UPPER(c) AS _c2]) StreamTableSourceScan(table=[[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. > ProjectNode and FilterNode cannot merge in Batch TableAPI/SQL > ------------------------------------------------------------- > > 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 result = table.where('a < 60).select('a * 1.2, 'b / 2, 'c) > {code} > we run the above code in the Batch TableAPI/SQL, we would get the following > optimizedPlan > {code} > DataSetCalc(select=[*(a, 1.2E0) AS _c0, /(b, 2) AS _c1, c]) > DataSetCalc(select=[a, b, c], where=[<(a, 60)]) > DataSetScan(table=[[_DataSetTable_0]]) > {code} > However, we run the above code in the Stream TableAPI/SQL, we would get the > following optimizedPlan > {code} > DataStreamCalc(select=[*(a, 1.2E0) AS _c0, /(b, 2) AS _c1, c], where=[<(a, > 60)]) > DataStreamScan(table=[[_DataStreamTable_0]]) > {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)