Skip to content

[SPARK-11672] [ML] set active SQLContext in JavaDefaultReadWriteSuite #9719

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
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@
public class JavaDefaultReadWriteSuite {

JavaSparkContext jsc = null;
SQLContext sqlContext = null;
File tempDir = null;

@Before
public void setUp() {
jsc = new JavaSparkContext("local[2]", "JavaDefaultReadWriteSuite");
SQLContext.clearActive();
sqlContext = new SQLContext(jsc);
SQLContext.setActive(sqlContext);
tempDir = Utils.createTempDir(
System.getProperty("java.io.tmpdir"), "JavaDefaultReadWriteSuite");
}

@After
public void tearDown() {
sqlContext = null;
SQLContext.clearActive();
if (jsc != null) {
jsc.stop();
jsc = null;
Expand All @@ -64,7 +70,6 @@ public void testDefaultReadWrite() throws IOException {
} catch (IOException e) {
// expected
}
SQLContext sqlContext = new SQLContext(jsc);
instance.write().context(sqlContext).overwrite().save(outputPath);
MyParams newInstance = MyParams.load(outputPath);
Assert.assertEquals("UID should match.", instance.uid(), newInstance.uid());
Expand Down