GitHub user viirya opened a pull request:
https://github.com/apache/spark/pull/15837
[SQL] Evaluate common subexpression like lazy variable with a function
approach
## What changes were proposed in this pull request?
As per the discussion at #15807, we need to change the way of subexpression
elimination for wholestage codegen.
In current approach, common subexpressions are evaluated no matter they are
really used or not later. E.g., in the following generated codes, `subexpr2` is
evaluated even only the `if` branch is run.
if (isNull(subexpr)) {
...
} else {
AssertNotNull(subexpr) // subexpr2
....
SomeExpr(AssertNotNull(subexpr)) // SomeExpr(subexpr2)
}
Besides possible performance regression, the expression like
`AssertNotNull` can throw exception. So wrongly evaluating `subexpr2` will
throw exception unexceptedly..
## How was this patch tested?
Jenkins tests.
Please review
https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark before
opening a pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/viirya/spark-1 improve-subexpr-elimination
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15837.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 #15837
----
commit c0153a693991b0915b12e5c0a208cc08ee323893
Author: Liang-Chi Hsieh <[email protected]>
Date: 2016-11-10T04:57:35Z
Evaluate common subexpression like lazy variable with a function approach.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]