dongjoon-hyun commented on a change in pull request #29776:
URL: https://github.com/apache/spark/pull/29776#discussion_r489797852



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodegenExpressionCachingSuite.scala
##########
@@ -85,6 +85,36 @@ class CodegenExpressionCachingSuite extends SparkFunSuite {
     assert(instance2.eval(null))
   }
 
+  test("SPARK-32903: GeneratePredicate should eliminate sub-expressions") {
+    Seq(true, false).foreach { enabled =>
+      val leaf1 = ExprWithEvaluatedState()
+      val leaf2 = ExprWithEvaluatedState()
+      val leaf3 = ExprWithEvaluatedState()
+      val leaf4 = ExprWithEvaluatedState()
+
+      val expr1 = And(leaf1, leaf2)
+      val expr2 = And(leaf3, leaf4)
+      val cond = Or(expr1, expr2)

Review comment:
       To avoid the misleading, shall we change like this?
   ```scala
   - val expr1 = And(leaf1, leaf2)
   - val expr2 = And(leaf3, leaf4)
   - val cond = Or(expr1, expr2)
   val cond = Or(And(leaf1, leaf2), And(leaf3, leaf4))
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to