From 228730b2582daf506bc5126eb7d1144ec6f295cb Mon Sep 17 00:00:00 2001 From: gatorsmile Date: Tue, 3 Apr 2018 10:50:57 -0700 Subject: [PATCH 1/2] fix. --- .../scala/org/apache/spark/sql/hive/test/TestHive.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala index 814038d4ef7a..861cf49e818d 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala @@ -159,9 +159,10 @@ private[hive] class TestHiveSparkSession( private val loadTestTables: Boolean) extends SparkSession(sc) with Logging { self => - // TODO(SPARK-23826): TestHiveSparkSession should set default session the same way as - // TestSparkSession, but doing this the same way breaks many tests in the package. We need - // to investigate and find a different strategy. + // The base spark session does this in getOrCreate(), here we emulate that behavior for tests. + if (SparkSession.getDefaultSession.isEmpty) { + SparkSession.setDefaultSession(this) + } def this(sc: SparkContext, loadTestTables: Boolean) { this( From f7e0b034026691872c905ab4d5d09c381c56b7b0 Mon Sep 17 00:00:00 2001 From: gatorsmile Date: Tue, 3 Apr 2018 20:44:22 -0700 Subject: [PATCH 2/2] fix. --- .../main/scala/org/apache/spark/sql/hive/test/TestHive.scala | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala index 861cf49e818d..fcf2025d3443 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala @@ -159,11 +159,6 @@ private[hive] class TestHiveSparkSession( private val loadTestTables: Boolean) extends SparkSession(sc) with Logging { self => - // The base spark session does this in getOrCreate(), here we emulate that behavior for tests. - if (SparkSession.getDefaultSession.isEmpty) { - SparkSession.setDefaultSession(this) - } - def this(sc: SparkContext, loadTestTables: Boolean) { this( sc,