-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
68cebd0
ML Classification done
techaddict e8bae89
ml clustering done
techaddict afe620a
ML Feature done
techaddict f3a2244
ML Feature remove unused imports
techaddict 9e41936
ML Param Done - Remove SparkSession, esc since not used
techaddict b97da5b
ml regression done
techaddict a96fa3a
ml libsvm done
techaddict 29a1194
ml tuning, util done
techaddict 8ad34a0
mllib classification
techaddict 940d564
mllib clustering
techaddict 9d4d015
mllib evaluation and feature
techaddict e033253
mllib fpm
techaddict 3aa61df
mllib random
techaddict ddf68da
mllib recommendation
techaddict 90b048a
mllib regression
techaddict c3f166d
mllib tree
techaddict 36ce8d2
fix javastyle
techaddict 12ba028
add license to SharedSparkSession
techaddict 39cd94d
merge master
techaddict f3fa1f5
fix import
techaddict e4117f3
Mark custom methods as protected and add override
techaddict 874eddb
fix java lint errors
techaddict 8e264ea
fix style
techaddict 92ae70b
Merge branch 'master' into SPARK-15296
techaddict 40edaad
remove customSetUp() and customTearDown()
techaddict 65307c5
Merge branch 'master' into SPARK-15296
techaddict 9b340fe
SparkSession appName should be class simple name
techaddict 622e28d
Merge branch 'master' into SPARK-15296
techaddict 56de3e4
Merge branch 'master' into SPARK-15296
techaddict c1ce08e
SharedSparkSession should implement Serializable
techaddict 2bcfdd7
fix imports
techaddict 9d7a89c
Merge branch 'master' into SPARK-15296
techaddict 138818b
fix
techaddict File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
mllib/src/test/java/org/apache/spark/SharedSparkSession.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * 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 java.io.Serializable; | ||
|
|
||
| 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 implements Serializable { | ||
|
|
||
| protected transient SparkSession spark; | ||
| protected transient JavaSparkContext jsc; | ||
|
|
||
| @Before | ||
| public void setUp() throws IOException { | ||
| spark = SparkSession.builder() | ||
| .master("local[2]") | ||
| .appName(getClass().getSimpleName()) | ||
| .getOrCreate(); | ||
| jsc = new JavaSparkContext(spark.sparkContext()); | ||
| } | ||
|
|
||
| @After | ||
| public void tearDown() { | ||
| spark.stop(); | ||
| spark = null; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
jsc needs to be stopped too?
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.
all jsc.stop will do is stop the underlying sparkContext which is anyways done by sparkSession.