You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2015/02/07 00:12:24 UTC
spark git commit: [SQL] Use TestSQLContext in Java tests
Repository: spark
Updated Branches:
refs/heads/master 61073f832 -> 76c4bf59f
[SQL] Use TestSQLContext in Java tests
Sometimes tests were failing due to the creation of multiple `SparkContext`s in a single JVM.
Author: Michael Armbrust <mi...@databricks.com>
Closes #4441 from marmbrus/javaTests and squashes the following commits:
657b1e0 [Michael Armbrust] [SQL] Use TestSQLContext in Java tests
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/76c4bf59
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/76c4bf59
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/76c4bf59
Branch: refs/heads/master
Commit: 76c4bf59f6544b9c02d99fd18436427cbce632e6
Parents: 61073f8
Author: Michael Armbrust <mi...@databricks.com>
Authored: Fri Feb 6 15:11:02 2015 -0800
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Fri Feb 6 15:11:02 2015 -0800
----------------------------------------------------------------------
.../test/java/org/apache/spark/sql/api/java/JavaAPISuite.java | 7 +++----
.../org/apache/spark/sql/api/java/JavaApplySchemaSuite.java | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/76c4bf59/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaAPISuite.java
----------------------------------------------------------------------
diff --git a/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaAPISuite.java b/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaAPISuite.java
index e558893..a21a154 100644
--- a/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaAPISuite.java
+++ b/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaAPISuite.java
@@ -19,6 +19,7 @@ package org.apache.spark.sql.api.java;
import java.io.Serializable;
+import org.apache.spark.sql.test.TestSQLContext$;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -37,14 +38,12 @@ public class JavaAPISuite implements Serializable {
@Before
public void setUp() {
- sc = new JavaSparkContext("local", "JavaAPISuite");
- sqlContext = new SQLContext(sc);
+ sqlContext = TestSQLContext$.MODULE$;
+ sc = new JavaSparkContext(sqlContext.sparkContext());
}
@After
public void tearDown() {
- sc.stop();
- sc = null;
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/spark/blob/76c4bf59/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaApplySchemaSuite.java
----------------------------------------------------------------------
diff --git a/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaApplySchemaSuite.java b/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaApplySchemaSuite.java
index 8510bac..2e6e977 100644
--- a/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaApplySchemaSuite.java
+++ b/sql/core/src/test/java/org/apache/spark/sql/api/java/JavaApplySchemaSuite.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.spark.sql.test.TestSQLContext$;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -42,13 +43,12 @@ public class JavaApplySchemaSuite implements Serializable {
@Before
public void setUp() {
- javaCtx = new JavaSparkContext("local", "JavaApplySchemaSuite");
- javaSqlCtx = new SQLContext(javaCtx);
+ javaSqlCtx = TestSQLContext$.MODULE$;
+ javaCtx = new JavaSparkContext(javaSqlCtx.sparkContext());
}
@After
public void tearDown() {
- javaCtx.stop();
javaCtx = null;
javaSqlCtx = null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org