GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/13392
[SPARK-15647] [SQL] Fix Boundary Cases in OptimizeCodegen Rule
#### What changes were proposed in this pull request?
The following condition in the Optimizer rule `OptimizeCodegen` is not
right.
```Scala
branches.size < conf.maxCaseBranchesForCodegen
```
- The number of branches in case when clause should be `branches.size +
elseBranch.size`.
- `maxCaseBranchesForCodegen` is the maximum boundary for enabling codegen.
Thus, we should use `<=` instead of `<`.
This PR is to fix this boundary case and also add missing test cases for
verifying the conf `MAX_CASES_BRANCHES`.
#### How was this patch tested?
Added test cases in `SQLConfSuite`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark maxCaseWhen
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13392.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 #13392
----
commit 40b70f3aea06e609366877e465b81a7e4463e0ee
Author: gatorsmile <[email protected]>
Date: 2016-05-29T06:43:28Z
fix the boundary case.
commit aaf5f2e4f2da231ccd9d5d7ddd4183c14c045f2b
Author: gatorsmile <[email protected]>
Date: 2016-05-29T06:45:23Z
remove the useless comments.
commit f351c104d363d97698bfa6ccd190b305c4334e78
Author: gatorsmile <[email protected]>
Date: 2016-05-29T06:47:15Z
style fix.
----
---
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]