Skip to content

Commit 1a2a866

Browse files
committed
set active SQLContext manually
1 parent 2b68807 commit 1a2a866

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private[util] sealed trait BaseReadWrite {
5050
*/
5151
protected final def sqlContext: SQLContext = {
5252
if (optionSQLContext.isEmpty) {
53-
optionSQLContext = Some(new SQLContext(SparkContext.getOrCreate()))
53+
optionSQLContext = Some(SQLContext.getOrCreate(SparkContext.getOrCreate()))
5454
}
5555
optionSQLContext.get
5656
}

mllib/src/test/scala/org/apache/spark/mllib/util/MLlibTestSparkContext.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ trait MLlibTestSparkContext extends BeforeAndAfterAll { self: Suite =>
3434
sc = new SparkContext(conf)
3535
SQLContext.clearActive()
3636
sqlContext = new SQLContext(sc)
37+
SQLContext.setActive(sqlContext)
3738
}
3839

3940
override def afterAll() {

0 commit comments

Comments
 (0)