Skip to content

Commit

Permalink
[SPARK-21950][SQL][PYTHON][TEST] pyspark.sql.tests.SQLTests2 should s…
Browse files Browse the repository at this point in the history
…top SparkContext.

## What changes were proposed in this pull request?

`pyspark.sql.tests.SQLTests2` doesn't stop newly created spark context in the test and it might affect the following tests.
This pr makes `pyspark.sql.tests.SQLTests2` stop `SparkContext`.

## How was this patch tested?

Existing tests.

Author: Takuya UESHIN <ueshin@databricks.com>

Closes #19158 from ueshin/issues/SPARK-21950.

(cherry picked from commit 57bc1e9)
Signed-off-by: Takuya UESHIN <ueshin@databricks.com>
  • Loading branch information
ueshin committed Sep 8, 2017
1 parent bf1f30d commit ac23491
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/pyspark/sql/tests.py
Expand Up @@ -1796,8 +1796,12 @@ def test_sparksession_with_stopped_sparkcontext(self):
self.sc.stop()
sc = SparkContext('local[4]', self.sc.appName)
spark = SparkSession.builder.getOrCreate()
df = spark.createDataFrame([(1, 2)], ["c", "c"])
df.collect()
try:
df = spark.createDataFrame([(1, 2)], ["c", "c"])
df.collect()
finally:
spark.stop()
sc.stop()


class HiveContextSQLTests(ReusedPySparkTestCase):
Expand Down

0 comments on commit ac23491

Please sign in to comment.