averyqi-db commented on code in PR #47877:
URL: https://github.com/apache/spark/pull/47877#discussion_r1742547158
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -598,7 +598,9 @@ object SimplifyConditionals extends Rule[LogicalPlan] {
// a branch with a true condition eliminates all following branches,
// these branches can be pruned away
val (h, t) = branches.span(_._1 != TrueLiteral)
- CaseWhen( h :+ t.head, None)
+ // Use the value of TrueLiteral expression as elseValue to maintain
+ // nullability of CaseWhen expressions
+ CaseWhen(h :+ t.head, t.head._2)
Review Comment:
Got it. Yes, it is a good idea to change null check instead. I'll
investigate this path.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]