GitHub user viirya opened a pull request:
https://github.com/apache/spark/pull/16454
[SPARK-19055][SQL][PySpark] Fix SparkSession initialization when
SparkContext is stopped
## What changes were proposed in this pull request?
In SparkSession initialization, we store created the instance of
SparkSession into a class variable _instantiatedContext. Next time we can use
SparkSession.builder.getOrCreate() to retrieve the existing SparkSession
instance.
However, when the active SparkContext is stopped and we create another new
SparkContext to use, the existing SparkSession is still associated with the
stopped SparkContext. So the operations with this existing SparkSession will be
failed.
We need to detect such case in SparkSession and renew the class variable
_instantiatedContext if needed.
## How was this patch tested?
New test added in PySpark.
Please review http://spark.apache.org/contributing.html before opening a
pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/viirya/spark-1 fix-pyspark-sparksession
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/16454.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #16454
----
commit 80bba5ead0601f3ef4b05fff5391d07a61e06341
Author: Liang-Chi Hsieh <[email protected]>
Date: 2017-01-03T03:06:21Z
Fix SparkSession initialization when previous SparkContext is stopped and
new SparkContext is created.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]