-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15296][MLlib] Refactor All Java Tests that use SparkSession #13101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 26 commits
68cebd0
e8bae89
afe620a
f3a2244
9e41936
b97da5b
a96fa3a
29a1194
8ad34a0
940d564
9d4d015
e033253
3aa61df
ddf68da
90b048a
c3f166d
36ce8d2
12ba028
39cd94d
f3fa1f5
e4117f3
874eddb
8e264ea
92ae70b
40edaad
65307c5
9b340fe
622e28d
56de3e4
c1ce08e
2bcfdd7
9d7a89c
138818b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| import org.junit.After; | ||
| import org.junit.Before; | ||
|
|
||
| import org.apache.spark.api.java.JavaSparkContext; | ||
| import org.apache.spark.sql.SparkSession; | ||
|
|
||
| public abstract class SharedSparkSession { | ||
|
|
||
| public transient SparkSession spark; | ||
|
||
| public transient JavaSparkContext jsc; | ||
|
||
|
|
||
| @Before | ||
| public void setUp() throws IOException { | ||
| spark = SparkSession.builder() | ||
| .master("local") | ||
|
||
| .appName("shared-spark-session") | ||
|
||
| .getOrCreate(); | ||
| jsc = new JavaSparkContext(spark.sparkContext()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jsc needs to be stopped too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all jsc.stop will do is stop the underlying sparkContext which is anyways done by sparkSession. |
||
| } | ||
|
|
||
| @After | ||
| public void tearDown() { | ||
| spark.stop(); | ||
| spark = null; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we include
implements Serializableto save some code?