[
https://issues.apache.org/jira/browse/FLINK-4068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15529774#comment-15529774
]
ASF GitHub Bot commented on FLINK-4068:
---------------------------------------
Github user twalthr commented on a diff in the pull request:
https://github.com/apache/flink/pull/2560#discussion_r80919671
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/BatchTableEnvironment.scala
---
@@ -228,19 +229,13 @@ abstract class BatchTableEnvironment(
}
/**
- * Translates a [[Table]] into a [[DataSet]].
- *
- * The transformation involves optimizing the relational expression
tree as defined by
+ * Generates the optimized [[RelNode]] tree from the relational
expression tree as defined by
* Table API calls and / or SQL queries and generating corresponding
[[DataSet]] operators.
*
* @param table The root node of the relational expression tree.
- * @param tpe The [[TypeInformation]] of the resulting [[DataSet]].
- * @tparam A The type of the resulting [[DataSet]].
- * @return The [[DataSet]] that corresponds to the translated [[Table]].
+ * @return The optimized [[RelNode]] tree
*/
- protected def translate[A](table: Table)(implicit tpe:
TypeInformation[A]): DataSet[A] = {
-
- validateType(tpe)
+ private[flink] def optimize(table: Table): RelNode = {
--- End diff --
`optimize` from `Table` to `RelNode` looks strange. I think
`optimize(relNode: RelNode): RelNode` would be better.
> Move constant computations out of code-generated `flatMap` functions.
> ---------------------------------------------------------------------
>
> Key: FLINK-4068
> URL: https://issues.apache.org/jira/browse/FLINK-4068
> Project: Flink
> Issue Type: Improvement
> Components: Table API & SQL
> Affects Versions: 1.1.0
> Reporter: Fabian Hueske
> Assignee: Jark Wu
>
> The generated functions for expressions of the Table API or SQL include
> constant computations.
> For instance the code generated for a predicate like:
> {code}
> myInt < (10 + 20)
> {code}
> looks roughly like:
> {code}
> public void flatMap(Row in, Collector<Row> out) {
> Integer in1 = in.productElement(1);
> int temp = 10 + 20;
> if (in1 < temp) {
> out.collect(in)
> }
> }
> {code}
> In this example the computation of {{temp}} is constant and could be moved
> out of the {{flatMap()}} method.
> The same might apply for generated function other than {{FlatMap}} as well.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)