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 2022/05/06 10:31:42 UTC

[GitHub] [spark] ulysses-you commented on a diff in pull request #36468: [SPARK-39106][SQL] Correct conditional expression constant folding

ulysses-you commented on code in PR #36468:
URL: https://github.com/apache/spark/pull/36468#discussion_r866699096


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -52,22 +52,28 @@ object ConstantFolding extends Rule[LogicalPlan] {
     case _ => false
   }
 
+  private def constantFolding(e: Expression): Expression = e match {
+    // do not partially fold children inside ConditionalExpression
+    case c: ConditionalExpression if !c.foldable => c

Review Comment:
   Ideally we can fold the `alwaysEvaluatedInputs` if it's foldable and replace them with literal, but we need add a new method like `withNewChidlren` in `ConditionalExpression`. It seems a little overkill. What do you think ? @cloud-fan @viirya @HyukjinKwon 



-- 
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: reviews-unsubscribe@spark.apache.org

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