Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/21539#discussion_r194902354 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala --- @@ -301,6 +290,37 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product { def mapChildren(f: BaseType => BaseType): BaseType = { if (children.nonEmpty) { var changed = false + def mapChild(child: Any): Any = child match { + case arg: TreeNode[_] if containsChild(arg) => --- End diff -- Yeah, so was about to do that but then I noticed that they handle different cases, `mapChild` handles `TreeNode` and `(TreeNode, TreeNode)`, whereas L326-L349 handles `TreeNode`, `Option[TreeNode]` and `Map[_, TreeNode]`. I am not sure if combining them is useful, and if it is then I'd rather do it in a different PR.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org