[ https://issues.apache.org/jira/browse/FLINK-3848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15650023#comment-15650023 ]
Jark Wu edited comment on FLINK-3848 at 11/9/16 7:07 AM: --------------------------------------------------------- Hi [~tonycox] , I have looked into your work and think you may have misunderstood this issue. The {{ProjectableTableSource}} interface is for projection push-down. Such as we have a Table with 5 columns ( a,b,c,d,e) but the query only need column {{a}}. {code} SELECT a FROM MyTable {code} Currently, the physical plan is a TableScan to read all columns out , and then apply a FlatMap to emit column {{a}}. If we have {{ProjectableTableSource}}, the TableScan should only read the column {{a}} out. It is a performance optimization. Users do not need to do something like {{prepareCsvSource.setProjection(Array("id"))}} to manually specify the projection columns. Correct me if I'm wrong [~fhueske]. was (Author: jark): Hi [~tonycox] , I have looked into your work and think you may have misunderstood this issue. The {{ProjectableTableSource}} interface is for projection push-down. Such as we have a Table with 5 columns ( a,b,c,d,e) but the query only need column a. {code} SELECT a FROM MyTable {code} Currently, the physical plan will be a TableScan to read all columns out , and then apply a FlatMap to emit column a. If we have {{ProjectableTableSource}}, the TableScan should only read the column {{a}} out. It is a performance optimization. So users do not need to do something like {{prepareCsvSource.setProjection(Array("id"))}} to manually specify the projection columns. Correct me if I'm wrong [~fhueske]. > Add ProjectableTableSource interface and translation rule > --------------------------------------------------------- > > Key: FLINK-3848 > URL: https://issues.apache.org/jira/browse/FLINK-3848 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL > Reporter: Fabian Hueske > Assignee: Anton Solovev > > Add a {{ProjectableTableSource}} interface for {{TableSource}} implementation > that support projection push-down. > The interface could look as follows > {code} > def trait ProjectableTableSource { > def setProjection(fields: Array[String]): Unit > } > {code} > In addition we need Calcite rules to push a projection into a TableScan that > refers to a {{ProjectableTableSource}}. We might need to tweak the cost model > as well to push the optimizer in the right direction. > Moreover, the {{CsvTableSource}} could be extended to implement > {{ProjectableTableSource}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)