[
https://issues.apache.org/jira/browse/FLINK-4068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15332427#comment-15332427
]
ASF GitHub Bot commented on FLINK-4068:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/2102#discussion_r67233943
--- Diff:
flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/sql/SelectITCase.scala
---
@@ -146,4 +148,21 @@ class SelectITCase(
tEnv.sql(sqlQuery)
}
+ @Test
+ def testConstantReduce(): Unit = {
--- End diff --
I think the assertion of this this test should not check the name of the
generate Flink operator.
Instead I propose the following:
- split the `translate()` method into an `optimize()` method that generates
the optimized `RelNode` tree and a `translate()` method that translates into a
`DataSet` / `DataStream` program.
- make the `optimize()` method `private[flink]` and therefore accessible
from a unit test
- add a `BatchTableEnvironmentTest` and a `StreamTableEnvironmentTest`
which check that the optimized `RelNode` tree contains reduced expressions.
> 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
> Affects Versions: 1.1.0
> Reporter: Fabian Hueske
>
> 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)