Skip to content

[SPARK-32727][SQL] Replace CaseWhen with If when there is only one case #29570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

tanelk
Copy link
Contributor

@tanelk tanelk commented Aug 28, 2020

What changes were proposed in this pull request?

CaseWhen can be simplified to If, when there is only one case. This opimization was partially present in the doGenCode of CaseWhen.

Why are the changes needed?

If has more potential optimization rules available than a complex CaseWhen. Optimization rules, that can work only on If and single-case CaseWhen do not have to handle these separately. For example #29567.

Does this PR introduce any user-facing change?

No

How was this patch tested?

New UT

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@HyukjinKwon HyukjinKwon changed the title [SPARK-32727][SQL] replace CaseWhen with If when there is only one case [SPARK-32727][SQL] Replace CaseWhen with If when there is only one case Aug 28, 2020
@tanelk
Copy link
Contributor Author

tanelk commented Aug 28, 2020

cc @cloud-fan @maropu

@tanelk
Copy link
Contributor Author

tanelk commented Aug 29, 2020

Duplicates #21850

@tanelk tanelk closed this Aug 29, 2020
@tanelk tanelk deleted the SPARK-32727 branch August 29, 2020 10:57
@dbtsai
Copy link
Member

dbtsai commented Aug 30, 2020

@tanelk I just know this is a similar work to my old PR, #21850 Since mine is old, and has conflicts with current master, would you mind to work together and submit a new PR? Feel free to take my PR, and work on top of it if you want. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants