Skip to content

Commit ae1896b

Browse files
committed
Provide implicits automatically
1 parent a80f9b0 commit ae1896b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/SortSuite.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@
1717

1818
package org.apache.spark.sql.execution
1919

20-
import org.apache.spark.sql.catalyst.expressions.{BoundReference, Ascending, SortOrder}
2120
import org.apache.spark.sql.catalyst.dsl.expressions._
2221

23-
import org.apache.spark.sql.test.TestSQLContext
24-
import org.apache.spark.sql.types.{IntegerType, StringType}
25-
2622
class SortSuite extends SparkPlanTest {
27-
import TestSQLContext.implicits.localSeqToDataFrameHolder
2823

2924
test("basic sorting using ExternalSort") {
3025

sql/core/src/test/scala/org/apache/spark/sql/execution/SparkPlanTest.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
package org.apache.spark.sql.execution
1919

20-
import scala.util.control.NonFatal
20+
import scala.language.implicitConversions
2121
import scala.reflect.runtime.universe.TypeTag
22+
import scala.util.control.NonFatal
2223

2324
import org.apache.spark.SparkFunSuite
2425

@@ -27,14 +28,21 @@ import org.apache.spark.sql.catalyst.expressions.BoundReference
2728
import org.apache.spark.sql.catalyst.util._
2829

2930
import org.apache.spark.sql.test.TestSQLContext
30-
import org.apache.spark.sql.{Row, DataFrame}
31+
import org.apache.spark.sql.{DataFrameHolder, Row, DataFrame}
3132

3233
/**
3334
* Base class for writing tests for individual physical operators. For an example of how this
3435
* class's test helper methods can be used, see [[SortSuite]].
3536
*/
3637
class SparkPlanTest extends SparkFunSuite {
3738

39+
/**
40+
* Creates a DataFrame from a local Seq of Product.
41+
*/
42+
implicit def localSeqToDataFrameHolder[A <: Product : TypeTag](data: Seq[A]): DataFrameHolder = {
43+
TestSQLContext.implicits.localSeqToDataFrameHolder(data)
44+
}
45+
3846
/**
3947
* Runs the plan and makes sure the answer matches the expected result.
4048
* @param input the input data to be used.

0 commit comments

Comments
 (0)