You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/05/17 22:38:11 UTC
[GitHub] [spark] Kimahriman commented on a change in pull request #32559: [SPARK-35410][SQL] SubExpr elimination should not include redundant children exprs in conditional expression
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org