gengliangwang commented on a change in pull request #32761:
URL: https://github.com/apache/spark/pull/32761#discussion_r645398711
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala
##########
@@ -549,6 +549,44 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]]
extends Product with Tre
}
}
+ /**
+ * Returns a copy of this node where `rule` has been recursively applied
first to all of its
+ * children and then itself (post-order). When `rule` does not apply to a
given node, it is left
+ * unchanged.
+ *
+ * @param cond a Lambda expression to prune tree traversals. If
`cond.apply` returns false
+ * on a TreeNode T, skips processing T and its subtree;
otherwise, processes
+ * T and its subtree recursively.
+ * @param rule the function use to transform this node and its descendant
nodes. The function
+ * takes a tuple as its input, where the first/second field is
the before/after
+ * image of applying the rule on the node's children.
+ * @param ruleId is a unique Id for `rule` to prune unnecessary tree
traversals. When it is
+ * UnknownRuleId, no pruning happens. Otherwise, if `rule`
(with id `ruleId`)
+ * has been marked as in effective on a TreeNode 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 transformUpWithBeforeAndAfterRuleOnChildren(
+ cond: BaseType => Boolean, ruleId: RuleId = UnknownRuleId)(
Review comment:
nit: 4 spaces indent.
--
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]