Kimahriman commented on a change in pull request #32559:
URL: https://github.com/apache/spark/pull/32559#discussion_r633911273
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
##########
@@ -309,6 +309,22 @@ class SubexpressionEliminationSuite extends SparkFunSuite
with ExpressionEvalHel
CodeGenerator.compile(code)
}
}
+
+ test("SPARK-35410: SubExpr elimination should not include redundant child
exprs " +
+ "for conditional expressions") {
Review comment:
Found a non-conditional example that still is an issue even with this
update (a bit contrived, but I'm sure there's a real use case)
```
val myUdf = udf(() => {
println("In UDF")
1
}).withName("myUdf")
spark.range(1).withColumn("a", myUdf()).select(($"a" + $"a") / ($"a" +
$"a")).show()
```
This generates subexpressions myUdf() and (myUdf() + myUdf()), even though
only the second one is used.
--
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]