wangyum opened a new pull request #30849:
URL: https://github.com/apache/spark/pull/30849
### What changes were proposed in this pull request?
1. Improve `SimplifyConditionals`.
Simplify `If(cond, TrueLiteral, FalseLiteral)` to `cond`.
Simplify `If(cond, FalseLiteral, TrueLiteral)` to `Not(cond)`.
2. Improve `PushFoldableIntoBranches`.
Add `Literal.create(null, dataType)` if `elseValue` is None when pushing
foldable through `CaseWhen` to improve this case:
```sql
CASE WHEN cond1 THEN null WHEN cond2 THEN null END => null
```
### Why are the changes needed?
Improve query performance.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Unit test.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]