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/07/02 10:26:03 UTC
[GitHub] [spark] cfmcgrady commented on a change in pull request #33142: [SPARK-35940][SQL] Refactor EquivalentExpressions to make it more efficient
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 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-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