You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/02/21 06:51:44 UTC
[jira] [Commented] (FLINK-5524) Support early out for code
generated conjunctive conditions
[ https://issues.apache.org/jira/browse/FLINK-5524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15875459#comment-15875459 ]
ASF GitHub Bot commented on FLINK-5524:
---------------------------------------
GitHub user KurtYoung opened a pull request:
https://github.com/apache/flink/pull/3372
[FLINK-5524] [table] Support early out for code generated AND/OR condition
For condition like a AND b, if the result of a is false, we can save b from execution.
For condition like a OR b, if the result of a is true, we can also save b from execution.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/KurtYoung/flink flink-5524
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/3372.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 #3372
----
commit 4f8c07ffc6ac99da67803114edb732e20df793e6
Author: Kurt Young <yk...@gmail.com>
Date: 2017-02-21T06:35:17Z
[FLINK-5524] [table] Support early out for code generated AND/OR conditions
----
> Support early out for code generated conjunctive conditions
> -----------------------------------------------------------
>
> Key: FLINK-5524
> URL: https://issues.apache.org/jira/browse/FLINK-5524
> Project: Flink
> Issue Type: Improvement
> Components: Table API & SQL
> Affects Versions: 1.2.0, 1.1.4, 1.3.0
> Reporter: Fabian Hueske
> Assignee: Kurt Young
>
> Currently, all nested conditions for a conjunctive predicate are evaluated before the conjunction is checked.
> A condition like {{(v1 == v2) && (v3 < 5)}} would be compiled into
> {code}
> boolean res1;
> if (v1 == v2) {
> res1 = true;
> } else {
> res1 = false;
> }
> boolean res2;
> if (v3 < 5) {
> res2 = true;
> } else {
> res2 = false;
> }
> boolean res3;
> if (res1 && res2) {
> res3 = true;
> } else {
> res3 = false;
> }
> if (res3) {
> // emit something
> }
> {code}
> It would be better to leave the generated code as early as possible, e.g., with a {{return}} instead of {{res1 = false}}. The code generator needs a bit of context information for that.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)