cloud-fan commented on code in PR #40446: URL: https://github.com/apache/spark/pull/40446#discussion_r1138040356
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala: ########## @@ -130,7 +133,19 @@ class EquivalentExpressions { // 2. ConditionalExpression: use its children that will always be evaluated. private def childrenToRecurse(expr: Expression): Seq[Expression] = expr match { case _: CodegenFallback => Nil - case c: ConditionalExpression => c.alwaysEvaluatedInputs + case c: ConditionalExpression => + if (shortcut) { + // The subexpression in conditional expression may not need to eval even if it appears Review Comment: not likely, but possible, `select or(a, and(b, b))` is also valid. BTW, I think we should not enable this new change by default, as it may lead to perf regression. -- 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