Skip to content

[SPARK-17261][PYSPARK] Using HiveContext after re-creating SparkContext in Spark 2.0 throws "Java.lang.illegalStateException: Cannot call methods on a stopped sparkContext" #14857

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

Conversation

zjffdu
Copy link
Contributor

@zjffdu zjffdu commented Aug 29, 2016

What changes were proposed in this pull request?

Set SparkSession._instantiatedContext as None so that we can recreate SparkSession again.

How was this patch tested?

Tested manually using the following command in pyspark shell

spark.stop()
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
spark.sql("show databases").show()

…xt in Spark 2.0 throws "Java.lang.illegalStateException: Cannot call methods on a stopped sparkContext"
@SparkQA
Copy link

SparkQA commented Aug 29, 2016

Test build #64558 has finished for PR 14857 at commit 986a24f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zjffdu
Copy link
Contributor Author

zjffdu commented Aug 30, 2016

@davies Could you help review it ?

@davies
Copy link
Contributor

davies commented Sep 2, 2016

LGTM

@davies
Copy link
Contributor

davies commented Sep 2, 2016

Merging into master and 2.0

@asfgit asfgit closed this in ea66228 Sep 2, 2016
asfgit pushed a commit that referenced this pull request Sep 2, 2016
…ext in Spark 2.0 throws "Java.lang.illegalStateException: Cannot call methods on a stopped sparkContext"

## What changes were proposed in this pull request?

Set SparkSession._instantiatedContext as None so that we can recreate SparkSession again.

## How was this patch tested?

Tested manually using the following command in pyspark shell
```
spark.stop()
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
spark.sql("show databases").show()
```

Author: Jeff Zhang <zjffdu@apache.org>

Closes #14857 from zjffdu/SPARK-17261.

(cherry picked from commit ea66228)
Signed-off-by: Davies Liu <davies.liu@gmail.com>
@coderfi
Copy link
Contributor

coderfi commented Sep 12, 2016

Awesome, we ran into this problem as well, and finally had some bandwidth to track down the cause well enough to be able to search for this pull request. Looking forward to test this in our fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants