Skip to content

Commit 563706e

Browse files
author
Justin Uang
committed
more test fixes
1 parent c89f03b commit 563706e

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/PlanQueryStageTest.scala

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818
package org.apache.spark.sql.execution.adaptive
1919

2020
import org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute
21-
import org.apache.spark.sql.catalyst.expressions.{Ascending, SortOrder}
2221
import org.apache.spark.sql.catalyst.plans.Inner
2322
import org.apache.spark.sql.catalyst.plans.physical.HashPartitioning
24-
import org.apache.spark.sql.execution.{RangeExec, SortExec}
23+
import org.apache.spark.sql.execution.RangeExec
2524
import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec
26-
import org.apache.spark.sql.execution.joins.SortMergeJoinExec
25+
import org.apache.spark.sql.execution.joins.{BuildRight, ShuffledHashJoinExec}
2726
import org.apache.spark.sql.internal.SQLConf
2827
import org.apache.spark.sql.test.SharedSQLContext
2928

@@ -53,7 +52,7 @@ class PlanQueryStageTest extends SharedSQLContext {
5352
conf.setConfString("spark.sql.exchange.reuse", "true")
5453

5554
val planQueryStage = PlanQueryStage(conf)
56-
val newPlan = planQueryStage(createMergeJoinPlan(100, 100))
55+
val newPlan = planQueryStage(createJoinExec(100, 100))
5756

5857
val collected = newPlan.collect {
5958
case e: ShuffleQueryStageInput => e.childStage
@@ -68,7 +67,7 @@ class PlanQueryStageTest extends SharedSQLContext {
6867
conf.setConfString("spark.sql.exchange.reuse", "true")
6968

7069
val planQueryStage = PlanQueryStage(conf)
71-
val newPlan = planQueryStage(createMergeJoinPlan(100, 101))
70+
val newPlan = planQueryStage(createJoinExec(100, 101))
7271

7372
val collected = newPlan.collect {
7473
case e: ShuffleQueryStageInput => e.childStage
@@ -78,25 +77,20 @@ class PlanQueryStageTest extends SharedSQLContext {
7877
assert(!collected(0).eq(collected(1)))
7978
}
8079

81-
def createMergeJoinPlan(leftNum: Int, rightNum: Int): SortMergeJoinExec = {
82-
val left = SortExec(
83-
Seq(SortOrder(UnresolvedAttribute("blah"), Ascending)),
84-
true,
85-
ShuffleExchangeExec(
86-
HashPartitioning(Seq(UnresolvedAttribute("blah")), 100),
87-
RangeExec(org.apache.spark.sql.catalyst.plans.logical.Range(1, leftNum, 1, 1))))
88-
89-
val right = SortExec(
90-
Seq(SortOrder(UnresolvedAttribute("blah"), Ascending)),
91-
true,
92-
ShuffleExchangeExec(
93-
HashPartitioning(Seq(UnresolvedAttribute("blah")), 100),
94-
RangeExec(org.apache.spark.sql.catalyst.plans.logical.Range(1, rightNum, 1, 1))))
95-
96-
SortMergeJoinExec(
80+
def createJoinExec(leftNum: Int, rightNum: Int): ShuffledHashJoinExec = {
81+
val left = ShuffleExchangeExec(
82+
HashPartitioning(Seq(UnresolvedAttribute("blah")), 100),
83+
RangeExec(org.apache.spark.sql.catalyst.plans.logical.Range(1, leftNum, 1, 1)))
84+
85+
val right = ShuffleExchangeExec(
86+
HashPartitioning(Seq(UnresolvedAttribute("blah")), 100),
87+
RangeExec(org.apache.spark.sql.catalyst.plans.logical.Range(1, rightNum, 1, 1)))
88+
89+
ShuffledHashJoinExec(
9790
Seq(UnresolvedAttribute("blah")),
9891
Seq(UnresolvedAttribute("blah")),
9992
Inner,
93+
BuildRight,
10094
None,
10195
left,
10296
right)

0 commit comments

Comments
 (0)