cloud-fan commented on a change in pull request #33142:
URL: https://github.com/apache/spark/pull/33142#discussion_r661921386
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala
##########
@@ -170,65 +171,75 @@ class EquivalentExpressions {
// can cause error like NPE.
(expr.isInstanceOf[PlanExpression[_]] && TaskContext.get != null)
- if (!skip && !addFunc(expr)) {
- childrenToRecurse(expr).foreach(addExprTree(_, addFunc))
-
commonChildrenToRecurse(expr).filter(_.nonEmpty).foreach(addCommonExprs(_,
addFunc))
+ if (!skip && !addExprToMap(expr, map)) {
+ val height = childrenToRecurse(expr).map(addExprTree0(_, map))
+ .reduceOption(_ max _).map(_ + 1).getOrElse(0)
+ map(ExpressionEquals(expr)).height = height
Review comment:
> For this purpose, we cannot simply use the height of an expression
instead?
makes sense. A true height (from root to the furthest leaf) is good enough
to quickly check child-parent relationship.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]