Skip to content

Commit

Permalink
Move test to PlannerSuite.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Aug 6, 2015
1 parent 0675956 commit adcc742
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,4 @@ class ExchangeSuite extends SparkPlanTest {
input.map(Row.fromTuple)
)
}

test("EnsureRequirements shouldn't add exchange to SMJ inputs if both are SinglePartition") {
val df = (1 to 10).map(Tuple1.apply).toDF("a").repartition(1)
val keys = Seq(df.col("a").expr)
val smj = SortMergeJoin(keys, keys, df.queryExecution.sparkPlan, df.queryExecution.sparkPlan)
val afterEnsureRequirements = EnsureRequirements(df.sqlContext).apply(smj)
if (afterEnsureRequirements.collect { case Exchange(_, _) => true }.nonEmpty) {
fail(s"No Exchanges should have been added:\n$afterEnsureRequirements")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.TestData._
import org.apache.spark.sql.catalyst.plans._
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.execution.joins.{BroadcastHashJoin, ShuffledHashJoin}
import org.apache.spark.sql.execution.joins.{BroadcastHashJoin, ShuffledHashJoin, SortMergeJoin}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.test.{SQLTestUtils, TestSQLContext}
import org.apache.spark.sql.test.TestSQLContext._
Expand Down Expand Up @@ -202,4 +202,14 @@ class PlannerSuite extends SparkFunSuite with SQLTestUtils {
}
}
}

test("EnsureRequirements shouldn't add exchange to SMJ inputs if both are SinglePartition") {
val df = (1 to 10).map(Tuple1.apply).toDF("a").repartition(1)
val keys = Seq(df.col("a").expr)
val smj = SortMergeJoin(keys, keys, df.queryExecution.sparkPlan, df.queryExecution.sparkPlan)
val afterEnsureRequirements = EnsureRequirements(df.sqlContext).apply(smj)
if (afterEnsureRequirements.collect { case Exchange(_, _) => true }.nonEmpty) {
fail(s"No Exchanges should have been added:\n$afterEnsureRequirements")
}
}
}

0 comments on commit adcc742

Please sign in to comment.