-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-14338][SQL] Improve SimplifyConditionals
rule to handle null
in IF/CASEWHEN
#12122
Conversation
deep-review this please |
@@ -33,6 +33,8 @@ object Literal { | |||
|
|||
val FalseLiteral: Literal = Literal(false, BooleanType) | |||
|
|||
val NullLiteral: Literal = Literal(null, NullType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detected duplicate pattern.
We should replace Literal(null, NullType)
in L55 with NullLiteral
.
@dongjoon-hyun Review complete. No major issues found. This matches Hive semantics, where This requires human decision. @JoshRosen @sameeragarwal @yhuai Please advise. |
Test build #54743 has finished for PR 12122 at commit
|
Test build #54747 has finished for PR 12122 at commit
|
Rebased and squashed. |
Test build #54758 has finished for PR 12122 at commit
|
It's strange. |
Test build #2729 has finished for PR 12122 at commit
|
@@ -773,17 +773,24 @@ object BooleanSimplification extends Rule[LogicalPlan] with PredicateHelper { | |||
* Simplifies conditional expressions (if / case). | |||
*/ | |||
object SimplifyConditionals extends Rule[LogicalPlan] with PredicateHelper { | |||
def falseOrNullLiteral(e: Expression): Boolean = e match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private def
LGTM pending Jenkins |
Thank you, @rxin . |
Test build #2730 has finished for PR 12122 at commit
|
Test build #54768 has finished for PR 12122 at commit
|
The last failure is also |
Rebased. |
Test build #54780 has finished for PR 12122 at commit
|
Test build #2733 has finished for PR 12122 at commit
|
Thanks - merging in master. |
@dongjoon-hyun Can you take a look at the scala 2.10 build? |
I think I fixed it just now. |
What changes were proposed in this pull request?
Currently,
SimplifyConditionals
handlestrue
andfalse
to optimize branches. This PR improvesSimplifyConditionals
to take advantage ofnull
conditions forif
andCaseWhen
expressions, too.Before
After
Hive
How was this patch tested?
Pass the Jenkins tests (including new extended test cases).