spark git commit: [SPARK-16715][TESTS] Fix a potential ExprId conflict for SubexpressionEliminationSuite."Semantic equals and hash"

2016-07-25 Thread zsxwing
Repository: spark
Updated Branches:
  refs/heads/branch-2.0 1b4f7cf13 -> 41e72f659


[SPARK-16715][TESTS] Fix a potential ExprId conflict for 
SubexpressionEliminationSuite."Semantic equals and hash"

## What changes were proposed in this pull request?

SubexpressionEliminationSuite."Semantic equals and hash" assumes the default 
AttributeReference's exprId wont' be "ExprId(1)". However, that depends on when 
this test runs. It may happen to use "ExprId(1)".

This PR detects the conflict and makes sure we create a different ExprId when 
the conflict happens.

## How was this patch tested?

Jenkins unit tests.

Author: Shixiong Zhu 

Closes #14350 from zsxwing/SPARK-16715.

(cherry picked from commit 12f490b5c85cdee26d47eb70ad1a1edd00504f21)
Signed-off-by: Shixiong Zhu 


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/41e72f65
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/41e72f65
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/41e72f65

Branch: refs/heads/branch-2.0
Commit: 41e72f65929c345aa21ebd4e00dadfbfb5acfdf3
Parents: 1b4f7cf
Author: Shixiong Zhu 
Authored: Mon Jul 25 16:08:29 2016 -0700
Committer: Shixiong Zhu 
Committed: Mon Jul 25 16:08:36 2016 -0700

--
 .../catalyst/expressions/SubexpressionEliminationSuite.scala   | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/41e72f65/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
--
diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
index 90e97d7..1e39b24 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
@@ -21,8 +21,12 @@ import org.apache.spark.sql.types.IntegerType
 
 class SubexpressionEliminationSuite extends SparkFunSuite {
   test("Semantic equals and hash") {
-val id = ExprId(1)
 val a: AttributeReference = AttributeReference("name", IntegerType)()
+val id = {
+  // Make sure we use a "ExprId" different from "a.exprId"
+  val _id = ExprId(1)
+  if (a.exprId == _id) ExprId(2) else _id
+}
 val b1 = a.withName("name2").withExprId(id)
 val b2 = a.withExprId(id)
 val b3 = a.withQualifier(Some("qualifierName"))


-
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org



spark git commit: [SPARK-16715][TESTS] Fix a potential ExprId conflict for SubexpressionEliminationSuite."Semantic equals and hash"

2016-07-25 Thread zsxwing
Repository: spark
Updated Branches:
  refs/heads/master f5ea7fe53 -> 12f490b5c


[SPARK-16715][TESTS] Fix a potential ExprId conflict for 
SubexpressionEliminationSuite."Semantic equals and hash"

## What changes were proposed in this pull request?

SubexpressionEliminationSuite."Semantic equals and hash" assumes the default 
AttributeReference's exprId wont' be "ExprId(1)". However, that depends on when 
this test runs. It may happen to use "ExprId(1)".

This PR detects the conflict and makes sure we create a different ExprId when 
the conflict happens.

## How was this patch tested?

Jenkins unit tests.

Author: Shixiong Zhu 

Closes #14350 from zsxwing/SPARK-16715.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/12f490b5
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/12f490b5
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/12f490b5

Branch: refs/heads/master
Commit: 12f490b5c85cdee26d47eb70ad1a1edd00504f21
Parents: f5ea7fe
Author: Shixiong Zhu 
Authored: Mon Jul 25 16:08:29 2016 -0700
Committer: Shixiong Zhu 
Committed: Mon Jul 25 16:08:29 2016 -0700

--
 .../catalyst/expressions/SubexpressionEliminationSuite.scala   | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/12f490b5/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
--
diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
index 90e97d7..1e39b24 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SubexpressionEliminationSuite.scala
@@ -21,8 +21,12 @@ import org.apache.spark.sql.types.IntegerType
 
 class SubexpressionEliminationSuite extends SparkFunSuite {
   test("Semantic equals and hash") {
-val id = ExprId(1)
 val a: AttributeReference = AttributeReference("name", IntegerType)()
+val id = {
+  // Make sure we use a "ExprId" different from "a.exprId"
+  val _id = ExprId(1)
+  if (a.exprId == _id) ExprId(2) else _id
+}
 val b1 = a.withName("name2").withExprId(id)
 val b2 = a.withExprId(id)
 val b3 = a.withQualifier(Some("qualifierName"))


-
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org