You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (JIRA)" <ji...@apache.org> on 2016/06/15 09:32:09 UTC

[jira] [Commented] (FLINK-4068) Move constant computations out of code-generated `flatMap` functions.

    [ https://issues.apache.org/jira/browse/FLINK-4068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15331446#comment-15331446 ] 

Jark Wu commented on FLINK-4068:
--------------------------------

I tested some cases and find that tableAPI will automatically evaluate the constant expression , e.g.  {{select('a + (2+3))}} is  {{select('a+5}} actually .  But sql will not do this automatically. However , we can use optimize rule to do this (this should be done so). 

The {{ReduceExpressionsRule.CALC_INSTANCE}} can do this,  and it has been in FlinkRuleSet, but it doesn't work. I further study it and find that we miss the executor in planner. This is the PR: https://github.com/apache/flink/pull/2102, just one line changed.

> 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)