File tree Expand file tree Collapse file tree 2 files changed +4
-22
lines changed
sql/core/src/test/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 2 files changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import org.apache.spark.sql.catalyst.dsl.expressions._
2121
2222class SortSuite extends SparkPlanTest {
2323
24+ // This test was originally added as an example of how to use [[SparkPlanTest]];
25+ // it's not designed to be a comprehensive test of ExternalSort.
2426 test(" basic sorting using ExternalSort" ) {
2527
2628 val input = Seq (
Original file line number Diff line number Diff line change @@ -77,25 +77,6 @@ class SparkPlanTest extends SparkFunSuite {
7777 case None =>
7878 }
7979 }
80-
81- /**
82- * Runs the plan and makes sure the answer matches the expected result.
83- * @param input the input data to be used.
84- * @param planFunction a function which accepts the input SparkPlan and uses it to instantiate
85- * the physical operator that's being tested.
86- * @param expectedAnswer the expected result in a [[Seq ]] of [[Product ]]s.
87- */
88- protected def checkAnswer [A <: Product : TypeTag ](
89- input : Seq [A ],
90- planFunction : SparkPlan => SparkPlan ,
91- expectedAnswer : Seq [A ]): Unit = {
92- val inputDf = TestSQLContext .createDataFrame(input)
93- val expectedRows = expectedAnswer.map(Row .fromTuple)
94- SparkPlanTest .checkAnswer(inputDf, planFunction, expectedRows) match {
95- case Some (errorMessage) => fail(errorMessage)
96- case None =>
97- }
98- }
9980}
10081
10182/**
@@ -128,9 +109,8 @@ object SparkPlanTest {
128109
129110 plan.transformExpressions {
130111 case UnresolvedAttribute (Seq (u)) =>
131- inputMap.get(u).getOrElse {
132- sys.error(s " Invalid Test: Cannot resolve $u given input ${inputMap}" )
133- }
112+ inputMap.getOrElse(u,
113+ sys.error(s " Invalid Test: Cannot resolve $u given input $inputMap" ))
134114 }
135115 }
136116
You can’t perform that action at this time.
0 commit comments