cloud-fan commented on a change in pull request #30852:
URL: https://github.com/apache/spark/pull/30852#discussion_r547722720
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ReplaceNullWithFalseInPredicateSuite.scala
##########
@@ -380,6 +382,52 @@ class ReplaceNullWithFalseInPredicateSuite extends
PlanTest {
testProjection(originalExpr = column, expectedExpr = column)
}
+ test("replace None of elseValue inside CaseWhen if all branches are
FalseLiteral") {
+ val allFalseBranches = Seq(
+ (UnresolvedAttribute("i") < Literal(10)) -> FalseLiteral,
+ (UnresolvedAttribute("i") > Literal(40)) -> FalseLiteral)
+ val allFalseCond = CaseWhen(allFalseBranches)
+
+ val nonAllFalseBranches = Seq(
+ (UnresolvedAttribute("i") < Literal(10)) -> FalseLiteral,
+ (UnresolvedAttribute("i") > Literal(40)) -> TrueLiteral)
+ val nonAllFalseCond = CaseWhen(nonAllFalseBranches, FalseLiteral)
+
+ testFilter(allFalseCond, FalseLiteral)
+ testJoin(allFalseCond, FalseLiteral)
+ testDelete(allFalseCond, FalseLiteral)
+ testUpdate(allFalseCond, FalseLiteral)
+
+ testFilter(nonAllFalseCond, nonAllFalseCond)
+ testJoin(nonAllFalseCond, nonAllFalseCond)
+ testDelete(nonAllFalseCond, nonAllFalseCond)
+ testUpdate(nonAllFalseCond, nonAllFalseCond)
+ }
+
+ test("replace None of elseValue inside CaseWhen if all branches are null") {
+ val allFalseBranches = Seq(
Review comment:
`allNullBranches`
----------------------------------------------------------------
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]