Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ trait MLlibTestSparkContext extends TempDirectory { self: Suite =>
* but the implicits import is needed in the constructor.
*/
protected object testImplicits extends SQLImplicits {
protected override def _sqlContext: SQLContext = self.spark.sqlContext
protected override def session: SparkSession = self.spark
}

private[spark] def standardize(instances: Array[Instance]): Array[Instance] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class SQLContext private[sql](val sparkSession: SparkSession)
* @since 1.3.0
*/
object implicits extends SQLImplicits with Serializable {
protected override def _sqlContext: SQLContext = self
protected override def session: SparkSession = self.sparkSession
}
// scalastyle:on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
*/
abstract class SQLImplicits extends LowPrioritySQLImplicits {

protected def _sqlContext: SQLContext
protected def session: SparkSession

/**
* Converts $"col name" into a [[Column]].
Expand Down Expand Up @@ -242,15 +242,15 @@ abstract class SQLImplicits extends LowPrioritySQLImplicits {
* @since 1.6.0
*/
implicit def rddToDatasetHolder[T : Encoder](rdd: RDD[T]): DatasetHolder[T] = {
DatasetHolder(_sqlContext.createDataset(rdd))
DatasetHolder(session.createDataset(rdd))
}

/**
* Creates a [[Dataset]] from a local Seq.
* @since 1.6.0
*/
implicit def localSeqToDatasetHolder[T : Encoder](s: Seq[T]): DatasetHolder[T] = {
DatasetHolder(_sqlContext.createDataset(s))
DatasetHolder(session.createDataset(s))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ class SparkSession private(
* @since 2.0.0
*/
object implicits extends SQLImplicits with Serializable {
protected override def _sqlContext: SQLContext = SparkSession.this.sqlContext
protected override def session: SparkSession = SparkSession.this
}
// scalastyle:on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object typed {

// TODO: This is pretty hacky. Maybe we should have an object for implicit encoders.
private val implicits = new SQLImplicits {
override protected def _sqlContext: SQLContext = null
override protected def session: SparkSession = null
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private[sql] trait SQLTestData { self =>

// Helper object to import SQL implicits without a concrete SQLContext
private object internalImplicits extends SQLImplicits {
protected override def _sqlContext: SQLContext = self.spark.sqlContext
protected override def session: SparkSession = self.spark
}

import internalImplicits._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private[sql] trait SQLTestUtilsBase
* but the implicits import is needed in the constructor.
*/
protected object testImplicits extends SQLImplicits {
protected override def _sqlContext: SQLContext = self.spark.sqlContext
protected override def session: SparkSession = self.spark
}

protected override def withSQLConf[T](pairs: (String, String)*)(f: => T): T = {
Expand Down