hvanhovell commented on a change in pull request #32060:
URL: https://github.com/apache/spark/pull/32060#discussion_r608566706



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala
##########
@@ -80,28 +105,57 @@ abstract class QueryPlan[PlanType <: QueryPlan[PlanType]]
    * transformExpressionsDown or transformExpressionsUp should be used.
    *
    * @param rule the rule to be applied to every expression in this operator.
+   * @param cond  a Lambda expression to prune tree traversals. If 
`cond.apply` returns false
+   *              on an expression T, skips processing T and its subtree; 
otherwise, processes
+   *              T and its subtree recursively.
+   * @param ruleId is a unique Id for `rule` to prune unnecessary tree 
traversals. When it is
+   *        RuleId.UnknownId, no pruning happens. Otherwise, if `rule`(with id 
`ruleId`) has been
+   *        marked as in effective on an expression T, skips processing T and 
its subtree. Do not
+   *        pass it if the rule is not purely functional and reads a varying 
initial state for
+   *        different invocations.
    */
-  def transformExpressions(rule: PartialFunction[Expression, Expression]): 
this.type = {
-    transformExpressionsDown(rule)
+  def transformExpressions(rule: PartialFunction[Expression, Expression],
+    cond: TreePatternBits => Boolean = AlwaysProcess.fn,
+    ruleId: Int = RuleIdCollection.UnknownId): this.type = {

Review comment:
       I was more referring that instead of an ID we should pass in the Rule or 
some identifier instead of an int.
   
   Passing in the rule would mean that we'd have the transformation logic in a 
different place. While that is definitely interesting, it is indeed a massive 
change.




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to