[
https://issues.apache.org/jira/browse/FLINK-4068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15331443#comment-15331443
]
ASF GitHub Bot commented on FLINK-4068:
---------------------------------------
GitHub user wuchong opened a pull request:
https://github.com/apache/flink/pull/2102
[FLINK-4068] [tableAPI] Move constant computations out of code-generated
The `ReduceExpressionsRule` rule can reduce constant expressions and
replacing them with the corresponding constant. We have
`ReduceExpressionsRule.CALC_INSTANCE` in both `DATASET_OPT_RULES` and
`DATASET_OPT_RULES`, but it dose not take effect. Because it require the
planner have an executor to evaluate the constant expressions. This PR does
this, and resolve FLINK-4068.
And some tests added.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/wuchong/flink FLINK-4068
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/2102.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2102
----
commit 786653b7be085c1e80481137fed3d47c5da2357a
Author: Jark Wu <[email protected]>
Date: 2016-06-15T09:19:35Z
[FLINK-4068] [tableAPI] Move constant computations out of code-generated
functions.
----
> 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)