This is an automated email from the ASF dual-hosted git repository.
yumwang pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 3e384ec [SPARK-34798][SQL][TESTS] Fix incorrect join condition
3e384ec is described below
commit 3e384ec88e17c6aae70ffafb234e1a0ba7b11d3c
Author: Hongyi Zhang <[email protected]>
AuthorDate: Fri Mar 19 23:35:15 2021 +0800
[SPARK-34798][SQL][TESTS] Fix incorrect join condition
### What changes were proposed in this pull request?
join condition 'a.attr == 'c.attr check the reference of these 2 objects
which will always returns false. we need to use === instead
### Why are the changes needed?
Although this join condition always false doesn't break the test but it is
not what we expected. We should fix it to avoid future confusing
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
UT
Closes #31890 from opensky142857/SPARK-34798.
Authored-by: Hongyi Zhang <[email protected]>
Signed-off-by: Yuming Wang <[email protected]>
(cherry picked from commit 6f89cdfb0c2ecb7c7f105b59803096e16a2d29f5)
Signed-off-by: Yuming Wang <[email protected]>
---
.../spark/sql/catalyst/optimizer/OptimizeLimitZeroSuite.scala | 6 +++---
.../spark/sql/catalyst/optimizer/PropagateEmptyRelationSuite.scala | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/OptimizeLimitZeroSuite.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/OptimizeLimitZeroSuite.scala
index cf875ef..c8c1ecd 100644
---
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/OptimizeLimitZeroSuite.scala
+++
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/OptimizeLimitZeroSuite.scala
@@ -74,7 +74,7 @@ class OptimizeLimitZeroSuite extends PlanTest {
).foreach { case (jt, correctAnswer) =>
test(s"Limit 0: for join type $jt") {
val query = testRelation1
- .join(testRelation2.limit(0), joinType = jt, condition =
Some('a.attr == 'b.attr))
+ .join(testRelation2.limit(0), joinType = jt, condition =
Some('a.attr === 'b.attr))
val optimized = Optimize.execute(query.analyze)
@@ -86,9 +86,9 @@ class OptimizeLimitZeroSuite extends PlanTest {
val testRelation3 = LocalRelation.fromExternalRows(Seq('c.int), data =
Seq(Row(1)))
val subJoinQuery = testRelation1
- .join(testRelation2, joinType = Inner, condition = Some('a.attr ==
'b.attr))
+ .join(testRelation2, joinType = Inner, condition = Some('a.attr ===
'b.attr))
val query = subJoinQuery
- .join(testRelation3.limit(0), joinType = Inner, condition = Some('a.attr
== 'c.attr))
+ .join(testRelation3.limit(0), joinType = Inner, condition = Some('a.attr
=== 'c.attr))
val optimized = Optimize.execute(query.analyze)
val correctAnswer = LocalRelation('a.int, 'b.int, 'c.int)
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PropagateEmptyRelationSuite.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PropagateEmptyRelationSuite.scala
index 535be12..f157a5a 100644
---
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PropagateEmptyRelationSuite.scala
+++
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PropagateEmptyRelationSuite.scala
@@ -111,7 +111,7 @@ class PropagateEmptyRelationSuite extends PlanTest {
testcases.foreach { case (left, right, jt, answer) =>
val query = testRelation1
.where(left)
- .join(testRelation2.where(right), joinType = jt, condition =
Some('a.attr == 'b.attr))
+ .join(testRelation2.where(right), joinType = jt, condition =
Some('a.attr === 'b.attr))
val optimized = Optimize.execute(query.analyze)
val correctAnswer =
answer.getOrElse(OptimizeWithoutPropagateEmptyRelation.execute(query.analyze))
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]