GitHub user saurfang opened a pull request:

    https://github.com/apache/spark/pull/9205

    [SPARK-11244][SPARKR] sparkR.stop() should remove SQLContext

    SparkR should remove `.sparkRSQLsc` and `.sparkRHivesc` when 
`sparkR.stop()` is called. Otherwise even when SparkContext is reinitialized, 
`sparkRSQL.init` returns the stale copy of the object and complains:
    
    ```r
    sc <- sparkR.init("local")
    sqlContext <- sparkRSQL.init(sc)
    sparkR.stop()
    sc <- sparkR.init("local")
    sqlContext <- sparkRSQL.init(sc)
    sqlContext
    ```
    producing
    ```r
    Error in callJMethod(x, "getClass") : 
      Invalid jobj 1. If SparkR was restarted, Spark operations need to be 
re-executed.
    ```
    
    I have added the check and removal only when SparkContext itself is 
initialized. I have also added corresponding test for this fix. Let me know if 
you want me to move the test to SQL test suite instead.
    
    p.s. I tried lint-r but ended up a lots of errors on existing code.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/saurfang/spark sparkR.stop

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/9205.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 #9205
    
----
commit 7f5154907ad45811722019f275b90cd12cff1134
Author: Forest Fang <forest.f...@outlook.com>
Date:   2015-10-21T19:49:00Z

    remove SQLContext on stop

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to