hvanhovell commented on a change in pull request #24766: [SPARK-27917][SQL]
canonical form of CaseWhen object is incorrect
URL: https://github.com/apache/spark/pull/24766#discussion_r289654733
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala
##########
@@ -234,6 +234,8 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]]
extends Product {
}
def mapChild(child: Any): Any = child match {
case arg: TreeNode[_] if containsChild(arg) => mapTreeNode(arg)
+ // CaseWhen Case or any tuple type
+ case tuple: (_, _) => (mapChild(tuple._1), mapChild(tuple._2))
Review comment:
Let's make better use of pattern matching here, and deconstruct the tuple
there, e.g.: `case (left, right) => (mapChild(left), mapChild(right))`
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]