cloud-fan commented on a change in pull request #33142: URL: https://github.com/apache/spark/pull/33142#discussion_r660900471
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala ########## @@ -135,33 +125,47 @@ class EquivalentExpressions { // For some special expressions we cannot just recurse into all of its children, but we can // recursively add the common expressions shared between all of its children. private def commonChildrenToRecurse(expr: Expression): Seq[Seq[Expression]] = expr match { + case _: CodegenFallback => Nil case i: If => Seq(Seq(i.trueValue, i.falseValue)) case c: CaseWhen => // We look at subexpressions in conditions and values of `CaseWhen` separately. It is // because a subexpression in conditions will be run no matter which condition is matched // if it is shared among conditions, but it doesn't need to be shared in values. Similarly, // a subexpression among values doesn't need to be in conditions because no matter which // condition is true, it will be evaluated. - val conditions = c.branches.tail.map(_._1) + val conditions = if (c.branches.length > 1) { Review comment: This fixes https://github.com/apache/spark/pull/30245#discussion_r660870034 -- 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-unsubscr...@spark.apache.org 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