Kimahriman commented on a change in pull request #32987:
URL: https://github.com/apache/spark/pull/32987#discussion_r674791578



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
##########
@@ -193,13 +193,15 @@ class SubexpressionEliminationSuite extends SparkFunSuite 
with ExpressionEvalHel
       (GreaterThan(add2, Literal(4)), add1) ::
       (GreaterThan(add2, Literal(5)), add1) :: Nil
 
-    val caseWhenExpr1 = CaseWhen(conditions1, None)
-    val equivalence1 = new EquivalentExpressions
-    equivalence1.addExprTree(caseWhenExpr1)
-
-    // `add2` is repeatedly in all conditions.
-    assert(equivalence1.getAllExprStates().count(_.useCount == 2) == 1)
-    assert(equivalence1.getAllExprStates().filter(_.useCount == 2).head.expr 
eq add2)
+    withSQLConf(SQLConf.SUBEXPRESSION_ELIMINATION_CONDITIONALS_ENABLED.key -> 
"true") {

Review comment:
       The not-first conditions are now handled as a conditional instead. 
Supports all the same existing behavior but additionally can create 
subexpressions for things only in one of the remaining conditions instead of 
all. For example, `CaseWhen((a + b) / (c + d) > 1, 1, a + b > 1, 2, c + d > 1, 
3)`, `a + b` and `c + d` will become subexpressions now where they wouldn't 
previously, though only with this config enabled if we need to keep the config




-- 
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]

Reply via email to