Uh oh!
There was an error while loading. Please reload this page.
[SPARK-21072][SQL] TreeNode.mapChildren should only apply to the children node. - #18284
[SPARK-21072][SQL] TreeNode.mapChildren should only apply to the children node.#18284ConeyLiu wants to merge 5 commits into
Conversation
ConeyLiu
commented
Jun 13, 2017
@cloud-fan Would you mind take a look? Thanks a lot. |
TreeNode.mapChildren should only apply to the children node.TreeNode.mapChildren should only apply to the children node.cloud-fan
commented
Jun 14, 2017
ok to test |
cloud-fan
commented
Jun 14, 2017
good catch! can you add a test in |
SparkQA
commented
Jun 14, 2017
Test build #78043 has finished for PR 18284 at commit
|
ConeyLiu
commented
Jun 14, 2017
Thanks for reviewing, I'll add it. |
SparkQA
commented
Jun 15, 2017
Test build #78075 has finished for PR 18284 at commit
|
| val newChild1 = if (containsChild(arg1)) { | ||
| f(arg1.asInstanceOf[BaseType]) | ||
| } else { | ||
| arg1 |
There was a problem hiding this comment.
we can call arg1.asInstanceOf[BaseType] here, to avoid this change
| } | ||
| case class SeqTupleExpression(sons: Seq[(Expression, Expression)], | ||
| notsons: Seq[(Expression, Expression)]) extends Expression with Unevaluable { |
| test("mapChildren should only works on children") { | ||
| val children = Seq((Literal(1), Literal(2))) | ||
| val notChildren = Seq((Literal(3), Literal(4))) |
| actual = before transformUp toZero | ||
| assert(actual === expect) | ||
| actual = before transform toZero |
There was a problem hiding this comment.
I think testing transform is good enough
There was a problem hiding this comment.
or we can testing mapChildren directly
SparkQA
commented
Jun 15, 2017
Test build #78081 has started for PR 18284 at commit |
ConeyLiu
commented
Jun 15, 2017
@cloud-fan thanks for reviewing, code has updated. |
SparkQA
commented
Jun 15, 2017
Test build #78082 has started for PR 18284 at commit |
I can't find the test failed message, seems like unrelated errors. Can you trigger jenkins test again ? because I'm not in the whitelist. Thanks a lot. |
| val expect = SeqTupleExpression(Seq((Literal(0), Literal(0))), nonChildren) | ||
| val actual = before mapChildren toZero | ||
| assert(actual === expect) |
There was a problem hiding this comment.
Maybe better to use .equals? Although it will call Object's .equals which is ==.
There was a problem hiding this comment.
I'm not sure if I understand it wrongly. === compared to == could provide more information about the error. You can see the follow examples:
scala> assert(1 == 2)
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:156)
... 32 elided
scala> assert(1 === 2)
<console>:12: error: value === is not a member of Int
assert(1 === 2)
And also you can check it in https://stackoverflow.com/questions/10489548/what-is-the-triple-equals-operator-in-scala-koans
cloud-fan
commented
Jun 15, 2017
retest this please |
viirya
commented
Jun 15, 2017
Nit: The PR title doesn't need to add ``. |
| } | ||
| case class SeqTupleExpression(sons: Seq[(Expression, Expression)], | ||
| nonSons: Seq[(Expression, Expression)]) extends Expression with Unevaluable { |
There was a problem hiding this comment.
Unevaluable already extends Expression. I think you don't need to extend Expression again?
viirya
commented
Jun 15, 2017
LGTM |
SparkQA
commented
Jun 15, 2017
Test build #78092 has finished for PR 18284 at commit
|
TreeNode.mapChildren should only apply to the children node.SparkQA
commented
Jun 15, 2017
Test build #78108 has finished for PR 18284 at commit
|
…dren node. ## What changes were proposed in this pull request? Just as the function name and comments of `TreeNode.mapChildren` mentioned, the function should be apply to all currently node children. So, the follow code should judge whether it is the children node. https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala#L342 ## How was this patch tested? Existing tests. Author: Xianyang Liu <xianyang.liu@intel.com> Closes#18284 from ConeyLiu/treenode. (cherry picked from commit 87ab0ce) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…dren node. ## What changes were proposed in this pull request? Just as the function name and comments of `TreeNode.mapChildren` mentioned, the function should be apply to all currently node children. So, the follow code should judge whether it is the children node. https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala#L342 ## How was this patch tested? Existing tests. Author: Xianyang Liu <xianyang.liu@intel.com> Closes#18284 from ConeyLiu/treenode. (cherry picked from commit 87ab0ce) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
cloud-fan
commented
Jun 16, 2017
thanks, merging to master/2.2/2.1! |
ConeyLiu
commented
Jun 16, 2017
thanks everyone for reviewing. |
…dren node. ## What changes were proposed in this pull request? Just as the function name and comments of `TreeNode.mapChildren` mentioned, the function should be apply to all currently node children. So, the follow code should judge whether it is the children node. https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala#L342 ## How was this patch tested? Existing tests. Author: Xianyang Liu <xianyang.liu@intel.com> Closesapache#18284 from ConeyLiu/treenode.
…dren node. Just as the function name and comments of `TreeNode.mapChildren` mentioned, the function should be apply to all currently node children. So, the follow code should judge whether it is the children node. https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala#L342 Existing tests. Author: Xianyang Liu <xianyang.liu@intel.com> Closesapache#18284 from ConeyLiu/treenode. (cherry picked from commit 87ab0ce) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
What changes were proposed in this pull request?
Just as the function name and comments of
TreeNode.mapChildrenmentioned, the function should be apply to all currently node children. So, the follow code should judge whether it is the children node.https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala#L342
How was this patch tested?
Existing tests.