You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/06/11 05:23:18 UTC
[GitHub] [spark] dongjoon-hyun commented on a change in pull request #24837:
[SPARK-27917][SQL][BACKPORT-2.3] canonical form of CaseWhen object is
incorrect
dongjoon-hyun commented on a change in pull request #24837: [SPARK-27917][SQL][BACKPORT-2.3] canonical form of CaseWhen object is incorrect
URL: https://github.com/apache/spark/pull/24837#discussion_r292281227
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala
##########
@@ -199,44 +199,33 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product {
var changed = false
val remainingNewChildren = newChildren.toBuffer
val remainingOldChildren = children.toBuffer
+ def mapTreeNode(node: TreeNode[_]): TreeNode[_] = {
+ val newChild = remainingNewChildren.remove(0)
+ val oldChild = remainingOldChildren.remove(0)
+ if (newChild fastEquals oldChild) {
+ oldChild
+ } else {
+ changed = true
+ newChild
+ }
+ }
+ def mapChild(child: Any): Any = child match {
+ case arg: TreeNode[_] if containsChild(arg) => mapTreeNode(arg)
+ // CaseWhen Case or any tuple type
+ case (left, right) => (mapChild(left), mapChild(right))
+ case nonChild: AnyRef => nonChild
+ case null => null
+ }
Review comment:
Wow, it looks too risk backport..
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org