File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
core/src/test/scala/org/apache/spark/sql/test
hive/src/main/scala/org/apache/spark/sql/hive/test Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ private[spark] class TestSparkSession(sc: SparkContext) extends SparkSession(sc)
34
34
this (new SparkConf )
35
35
}
36
36
37
+ SparkSession .setDefaultSession(this )
38
+
37
39
@ transient
38
40
override lazy val sessionState : SessionState = {
39
41
new TestSQLSessionStateBuilder (this , None ).build()
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ package org .apache .spark .sql .test
19
+
20
+ import org .apache .spark .SparkFunSuite
21
+ import org .apache .spark .sql .SparkSession
22
+
23
+ class TestSparkSessionSuite extends SparkFunSuite {
24
+ test(" default session is set in constructor" ) {
25
+ val session = new TestSparkSession ()
26
+ assert(SparkSession .getDefaultSession.contains(session))
27
+ session.stop()
28
+ }
29
+ }
Original file line number Diff line number Diff line change @@ -159,6 +159,10 @@ private[hive] class TestHiveSparkSession(
159
159
private val loadTestTables : Boolean )
160
160
extends SparkSession (sc) with Logging { self =>
161
161
162
+ // TODO(SPARK-23826): TestHiveSparkSession should set default session the same way as
163
+ // TestSparkSession, but doing this the same way breaks many tests in the package. We need
164
+ // to investigate and find a different strategy.
165
+
162
166
def this (sc : SparkContext , loadTestTables : Boolean ) {
163
167
this (
164
168
sc,
You can’t perform that action at this time.
0 commit comments