cfmcgrady commented on a change in pull request #33142: URL: https://github.com/apache/spark/pull/33142#discussion_r662909946
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala ########## @@ -93,25 +72,33 @@ class EquivalentExpressions { */ private def addCommonExprs( exprs: Seq[Expression], - addFunc: Expression => Boolean = addExpr): Unit = { - val exprSetForAll = mutable.Set[Expr]() - addExprTree(exprs.head, addExprToSet(_, exprSetForAll)) - - val candidateExprs = exprs.tail.foldLeft(exprSetForAll) { (exprSet, expr) => - val otherExprSet = mutable.Set[Expr]() - addExprTree(expr, addExprToSet(_, otherExprSet)) - exprSet.intersect(otherExprSet) + map: mutable.HashMap[ExpressionEquals, ExpressionStats]): Unit = { + assert(exprs.length > 1) + var localEquivalenceMap = mutable.HashMap.empty[ExpressionEquals, ExpressionStats] Review comment: This also fixed that, previously, for `Or(Coalesce(expr1, expr2, expr2), Coalesce(expr1, expr2, expr2))`, `expr2` will be extracted and considered as a common subexpression. Currently, no subexpression will be extracted. -- 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