maropu commented on a change in pull request #32586: URL: https://github.com/apache/spark/pull/32586#discussion_r634978302
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala ########## @@ -167,7 +167,23 @@ class EquivalentExpressions { * Returns all the equivalent sets of expressions. */ def getAllEquivalentExprs: Seq[Seq[Expression]] = { - equivalenceMap.values.map(_.toSeq).toSeq + equivalenceMap.values.map(_.toSeq).toSeq.sortBy(_.head)(new ExpressionOrdering) + } + + /** + * Orders [Expression] by parent/child relations. The child expression is smaller + * than parent expression. Review comment: > If there is child-parent relationships among the subexpressions, we want the child expressions come first than parent expressions, so we can replace child expressions in parent expressions with subexpression evaluation. How about leaving this comment here? I think this explanation looks clearer. -- 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. 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