kazuyukitanimura commented on a change in pull request #34055:
URL: https://github.com/apache/spark/pull/34055#discussion_r715125418
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/BinaryComparisonSimplificationSuite.scala
##########
@@ -194,4 +199,15 @@ class BinaryComparisonSimplificationSuite extends PlanTest
with PredicateHelper
Optimize.execute(testRelation.select(Coalesce(Seq('b,
'd)).as("out")).analyze),
testRelation.select(Coalesce(Seq('b, 'd)).as("out")).analyze)
}
+
+ test("SPARK-36721: Simplify boolean equalities if one side is literal") {
+ checkCondition(boolRelation, And('a, 'b) === TrueLiteral, And('a, 'b))
+ checkCondition(boolRelation, TrueLiteral === And('a, 'b), And('a, 'b))
+ checkCondition(boolRelation, And('a, 'b) === FalseLiteral, Or(Not('a),
Not('b)))
+ checkCondition(boolRelation, FalseLiteral === And('a, 'b), Or(Not('a),
Not('b)))
+ checkCondition(boolRelation, IsNull('a) <=> TrueLiteral, IsNull('a))
Review comment:
Updated
--
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]